diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/README.md b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/README.md
index a3c8744008bbf..1798140bd21b9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/README.md
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/README.md
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Python
This is the Microsoft Azure Kubernetes Configuration Management Client Library.
-This package has been tested with Python 3.7+.
+This package has been tested with Python 3.8+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
### Prerequisites
-- Python 3.7+ is required to use this package.
+- Python 3.8+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)
### Install the package
@@ -59,6 +59,3 @@ Code samples for this package can be found at:
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
-
-
-![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-kubernetesconfiguration%2FREADME.png)
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json
index a90f0b4ebdced..c2481932f09fe 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json
@@ -1,12 +1,12 @@
{
- "commit": "1e8766756bb5c13fa573b0a33ab7d9438837c380",
+ "commit": "5dfb10f4156489fd0617114600abc1627b3c0f0e",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
- "autorest": "3.9.7",
+ "autorest": "3.10.2",
"use": [
- "@autorest/python@6.7.1",
- "@autorest/modelerfour@4.26.2"
+ "@autorest/python@6.26.4",
+ "@autorest/modelerfour@4.27.0"
],
- "autorest_command": "autorest specification/kubernetesconfiguration/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
+ "autorest_command": "autorest specification/kubernetesconfiguration/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.26.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/kubernetesconfiguration/resource-manager/readme.md",
"package-2023-05": "2023-05-16 19:49:17 -0700 433f115ecea40137ec80dfc0217582ccc52bbd37 Microsoft.KubernetesConfiguration/stable/2023-05-01/operations.json",
"package-2022-11": "2022-11-11 23:31:05 -0800 d11245bcaa06b6d87db179c903ba4b049adf1bf2 Microsoft.KubernetesConfiguration/stable/2022-11-01/operations.json",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py
index ece4e8f4f3ec6..0ffb0f599bbed 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py
@@ -10,7 +10,6 @@
# --------------------------------------------------------------------------
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
@@ -20,7 +19,7 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration):
+class SourceControlConfigurationClientConfiguration:
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -42,12 +41,12 @@ def __init__(
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-kubernetesconfiguration/{}'.format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_serialization.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_serialization.py
index a00658b1fc190..dc8692e6ec0f9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_serialization.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_serialization.py
@@ -24,7 +24,6 @@
#
# --------------------------------------------------------------------------
-# pylint: skip-file
# pyright: reportUnnecessaryTypeIgnoreComment=false
from base64 import b64decode, b64encode
@@ -52,7 +51,6 @@
MutableMapping,
Type,
List,
- Mapping,
)
try:
@@ -63,8 +61,8 @@
import isodate # type: ignore
-from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback
-from azure.core.serialization import NULL as AzureCoreNull
+from azure.core.exceptions import DeserializationError, SerializationError
+from azure.core.serialization import NULL as CoreNull
_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
@@ -91,6 +89,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type:
:param data: Input, could be bytes or stream (will be decoded with UTF8) or text
:type data: str or bytes or IO
:param str content_type: The content type.
+ :return: The deserialized data.
+ :rtype: object
"""
if hasattr(data, "read"):
# Assume a stream
@@ -112,7 +112,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type:
try:
return json.loads(data_as_str)
except ValueError as err:
- raise DeserializationError("JSON is invalid: {}".format(err), err)
+ raise DeserializationError("JSON is invalid: {}".format(err), err) from err
elif "xml" in (content_type or []):
try:
@@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type:
pass
return ET.fromstring(data_as_str) # nosec
- except ET.ParseError:
+ except ET.ParseError as err:
# It might be because the server has an issue, and returned JSON with
# content-type XML....
# So let's try a JSON load, and if it's still broken
@@ -143,7 +143,9 @@ def _json_attemp(data):
# The function hack is because Py2.7 messes up with exception
# context otherwise.
_LOGGER.critical("Wasn't XML not JSON, failing")
- raise_with_traceback(DeserializationError, "XML is invalid")
+ raise DeserializationError("XML is invalid") from err
+ elif content_type.startswith("text/"):
+ return data_as_str
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
@classmethod
@@ -153,6 +155,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
Use bytes and headers to NOT use any requests/aiohttp or whatever
specific implementation.
Headers will tested for "content-type"
+
+ :param bytes body_bytes: The body of the response.
+ :param dict headers: The headers of the response.
+ :returns: The deserialized data.
+ :rtype: object
"""
# Try to use content-type from headers if available
content_type = None
@@ -170,13 +177,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
return None
-try:
- basestring # type: ignore
- unicode_str = unicode # type: ignore
-except NameError:
- basestring = str
- unicode_str = str
-
_LOGGER = logging.getLogger(__name__)
try:
@@ -189,15 +189,30 @@ class UTC(datetime.tzinfo):
"""Time Zone info for handling UTC"""
def utcoffset(self, dt):
- """UTF offset for UTC is 0."""
+ """UTF offset for UTC is 0.
+
+ :param datetime.datetime dt: The datetime
+ :returns: The offset
+ :rtype: datetime.timedelta
+ """
return datetime.timedelta(0)
def tzname(self, dt):
- """Timestamp representation."""
+ """Timestamp representation.
+
+ :param datetime.datetime dt: The datetime
+ :returns: The timestamp representation
+ :rtype: str
+ """
return "Z"
def dst(self, dt):
- """No daylight saving for UTC."""
+ """No daylight saving for UTC.
+
+ :param datetime.datetime dt: The datetime
+ :returns: The daylight saving time
+ :rtype: datetime.timedelta
+ """
return datetime.timedelta(hours=1)
@@ -211,7 +226,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore
:param datetime.timedelta offset: offset in timedelta format
"""
- def __init__(self, offset):
+ def __init__(self, offset) -> None:
self.__offset = offset
def utcoffset(self, dt):
@@ -240,24 +255,26 @@ def __getinitargs__(self):
_FLATTEN = re.compile(r"(? None:
- self.additional_properties: Dict[str, Any] = {}
- for k in kwargs:
+ self.additional_properties: Optional[Dict[str, Any]] = {}
+ for k in kwargs: # pylint: disable=consider-using-dict-items
if k not in self._attribute_map:
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
elif k in self._validation and self._validation[k].get("readonly", False):
@@ -305,13 +329,23 @@ def __init__(self, **kwargs: Any) -> None:
setattr(self, k, kwargs[k])
def __eq__(self, other: Any) -> bool:
- """Compare objects by comparing all attributes."""
+ """Compare objects by comparing all attributes.
+
+ :param object other: The object to compare
+ :returns: True if objects are equal
+ :rtype: bool
+ """
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
def __ne__(self, other: Any) -> bool:
- """Compare objects by comparing all attributes."""
+ """Compare objects by comparing all attributes.
+
+ :param object other: The object to compare
+ :returns: True if objects are not equal
+ :rtype: bool
+ """
return not self.__eq__(other)
def __str__(self) -> str:
@@ -331,7 +365,11 @@ def is_xml_model(cls) -> bool:
@classmethod
def _create_xml_node(cls):
- """Create XML node."""
+ """Create XML node.
+
+ :returns: The XML node
+ :rtype: xml.etree.ElementTree.Element
+ """
try:
xml_map = cls._xml_map # type: ignore
except AttributeError:
@@ -340,7 +378,7 @@ def _create_xml_node(cls):
return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None))
def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
- """Return the JSON that would be sent to azure from this model.
+ """Return the JSON that would be sent to server from this model.
This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`.
@@ -351,14 +389,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
:rtype: dict
"""
serializer = Serializer(self._infer_class_models())
- return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs)
+ return serializer._serialize( # type: ignore # pylint: disable=protected-access
+ self, keep_readonly=keep_readonly, **kwargs
+ )
def as_dict(
self,
keep_readonly: bool = True,
- key_transformer: Callable[
- [str, Dict[str, Any], Any], Any
- ] = attribute_transformer,
+ key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer,
**kwargs: Any
) -> JSON:
"""Return a dict that can be serialized using json.dump.
@@ -387,12 +425,15 @@ def my_key_transformer(key, attr_desc, value):
If you want XML serialization, you can pass the kwargs is_xml=True.
+ :param bool keep_readonly: If you want to serialize the readonly attributes
:param function key_transformer: A key transformer function.
:returns: A dict JSON compatible object
:rtype: dict
"""
serializer = Serializer(self._infer_class_models())
- return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs)
+ return serializer._serialize( # type: ignore # pylint: disable=protected-access
+ self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs
+ )
@classmethod
def _infer_class_models(cls):
@@ -402,7 +443,7 @@ def _infer_class_models(cls):
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
if cls.__name__ not in client_models:
raise ValueError("Not Autorest generated code")
- except Exception:
+ except Exception: # pylint: disable=broad-exception-caught
# Assume it's not Autorest generated (tests?). Add ourselves as dependencies.
client_models = {cls.__name__: cls}
return client_models
@@ -415,9 +456,10 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N
:param str content_type: JSON by default, set application/xml if XML.
:returns: An instance of this model
:raises: DeserializationError if something went wrong
+ :rtype: ModelType
"""
deserializer = Deserializer(cls._infer_class_models())
- return deserializer(cls.__name__, data, content_type=content_type)
+ return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
@classmethod
def from_dict(
@@ -433,9 +475,11 @@ def from_dict(
and last_rest_key_case_insensitive_extractor)
:param dict data: A dict using RestAPI structure
+ :param function key_extractors: A key extractor function.
:param str content_type: JSON by default, set application/xml if XML.
:returns: An instance of this model
:raises: DeserializationError if something went wrong
+ :rtype: ModelType
"""
deserializer = Deserializer(cls._infer_class_models())
deserializer.key_extractors = ( # type: ignore
@@ -447,7 +491,7 @@ def from_dict(
if key_extractors is None
else key_extractors
)
- return deserializer(cls.__name__, data, content_type=content_type)
+ return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
@classmethod
def _flatten_subtype(cls, key, objects):
@@ -455,21 +499,25 @@ def _flatten_subtype(cls, key, objects):
return {}
result = dict(cls._subtype_map[key])
for valuetype in cls._subtype_map[key].values():
- result.update(objects[valuetype]._flatten_subtype(key, objects))
+ result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access
return result
@classmethod
def _classify(cls, response, objects):
"""Check the class _subtype_map for any child classes.
We want to ignore any inherited _subtype_maps.
- Remove the polymorphic key from the initial data.
+
+ :param dict response: The initial data
+ :param dict objects: The class objects
+ :returns: The class to be used
+ :rtype: class
"""
for subtype_key in cls.__dict__.get("_subtype_map", {}).keys():
subtype_value = None
if not isinstance(response, ET.Element):
rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1]
- subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None)
+ subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None)
else:
subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response)
if subtype_value:
@@ -508,11 +556,13 @@ def _decode_attribute_map_key(key):
inside the received data.
:param str key: A key string from the generated code
+ :returns: The decoded key
+ :rtype: str
"""
return key.replace("\\.", ".")
-class Serializer(object):
+class Serializer(object): # pylint: disable=too-many-public-methods
"""Request object model serializer."""
basic_types = {str: "str", int: "int", bool: "bool", float: "float"}
@@ -547,7 +597,7 @@ class Serializer(object):
"multiple": lambda x, y: x % y != 0,
}
- def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None):
+ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None:
self.serialize_type = {
"iso-8601": Serializer.serialize_iso,
"rfc-1123": Serializer.serialize_rfc,
@@ -563,17 +613,20 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None):
"[]": self.serialize_iter,
"{}": self.serialize_dict,
}
- self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
+ self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_transformer = full_restapi_key_transformer
self.client_side_validation = True
- def _serialize(self, target_obj, data_type=None, **kwargs):
+ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals
+ self, target_obj, data_type=None, **kwargs
+ ):
"""Serialize data into a string according to type.
- :param target_obj: The data to be serialized.
+ :param object target_obj: The data to be serialized.
:param str data_type: The type to be serialized from.
:rtype: str, dict
:raises: SerializationError if serialization fails.
+ :returns: The serialized data.
"""
key_transformer = kwargs.get("key_transformer", self.key_transformer)
keep_readonly = kwargs.get("keep_readonly", False)
@@ -599,12 +652,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
serialized = {}
if is_xml_model_serialization:
- serialized = target_obj._create_xml_node()
+ serialized = target_obj._create_xml_node() # pylint: disable=protected-access
try:
- attributes = target_obj._attribute_map
+ attributes = target_obj._attribute_map # pylint: disable=protected-access
for attr, attr_desc in attributes.items():
attr_name = attr
- if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False):
+ if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access
+ attr_name, {}
+ ).get("readonly", False):
continue
if attr_name == "additional_properties" and attr_desc["key"] == "":
@@ -640,7 +695,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if isinstance(new_attr, list):
serialized.extend(new_attr) # type: ignore
elif isinstance(new_attr, ET.Element):
- # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces.
+ # If the down XML has no XML/Name,
+ # we MUST replace the tag with the local tag. But keeping the namespaces.
if "name" not in getattr(orig_attr, "_xml_map", {}):
splitted_tag = new_attr.tag.split("}")
if len(splitted_tag) == 2: # Namespace
@@ -651,7 +707,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
else: # That's a basic type
# Integrate namespace if necessary
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
- local_node.text = unicode_str(new_attr)
+ local_node.text = str(new_attr)
serialized.append(local_node) # type: ignore
else: # JSON
for k in reversed(keys): # type: ignore
@@ -670,18 +726,18 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
- raise_with_traceback(SerializationError, msg, err)
- else:
- return serialized
+ raise SerializationError(msg) from err
+ return serialized
def body(self, data, data_type, **kwargs):
"""Serialize data intended for a request body.
- :param data: The data to be serialized.
+ :param object data: The data to be serialized.
:param str data_type: The type to be serialized from.
:rtype: dict
:raises: SerializationError if serialization fails.
:raises: ValueError if data is None
+ :returns: The serialized request body
"""
# Just in case this is a dict
@@ -710,18 +766,20 @@ def body(self, data, data_type, **kwargs):
attribute_key_case_insensitive_extractor,
last_rest_key_case_insensitive_extractor,
]
- data = deserializer._deserialize(data_type, data)
+ data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access
except DeserializationError as err:
- raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err)
+ raise SerializationError("Unable to build a model: " + str(err)) from err
return self._serialize(data, data_type, **kwargs)
def url(self, name, data, data_type, **kwargs):
"""Serialize data intended for a URL path.
- :param data: The data to be serialized.
+ :param str name: The name of the URL path parameter.
+ :param object data: The data to be serialized.
:param str data_type: The type to be serialized from.
:rtype: str
+ :returns: The serialized URL path
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
"""
@@ -732,30 +790,30 @@ def url(self, name, data, data_type, **kwargs):
if kwargs.get("skip_quote") is True:
output = str(output)
+ output = output.replace("{", quote("{")).replace("}", quote("}"))
else:
output = quote(str(output), safe="")
- except SerializationError:
- raise TypeError("{} must be type {}.".format(name, data_type))
- else:
- return output
+ except SerializationError as exc:
+ raise TypeError("{} must be type {}.".format(name, data_type)) from exc
+ return output
def query(self, name, data, data_type, **kwargs):
"""Serialize data intended for a URL query.
- :param data: The data to be serialized.
+ :param str name: The name of the query parameter.
+ :param object data: The data to be serialized.
:param str data_type: The type to be serialized from.
- :keyword bool skip_quote: Whether to skip quote the serialized result.
- Defaults to False.
- :rtype: str
+ :rtype: str, list
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
+ :returns: The serialized query parameter
"""
try:
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
- do_quote = not kwargs.get('skip_quote', False)
- return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))
+ do_quote = not kwargs.get("skip_quote", False)
+ return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)
# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
@@ -765,19 +823,20 @@ def query(self, name, data, data_type, **kwargs):
output = str(output)
else:
output = quote(str(output), safe="")
- except SerializationError:
- raise TypeError("{} must be type {}.".format(name, data_type))
- else:
- return str(output)
+ except SerializationError as exc:
+ raise TypeError("{} must be type {}.".format(name, data_type)) from exc
+ return str(output)
def header(self, name, data, data_type, **kwargs):
"""Serialize data intended for a request header.
- :param data: The data to be serialized.
+ :param str name: The name of the header.
+ :param object data: The data to be serialized.
:param str data_type: The type to be serialized from.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
+ :returns: The serialized header
"""
try:
if data_type in ["[str]"]:
@@ -786,32 +845,31 @@ def header(self, name, data, data_type, **kwargs):
output = self.serialize_data(data, data_type, **kwargs)
if data_type == "bool":
output = json.dumps(output)
- except SerializationError:
- raise TypeError("{} must be type {}.".format(name, data_type))
- else:
- return str(output)
+ except SerializationError as exc:
+ raise TypeError("{} must be type {}.".format(name, data_type)) from exc
+ return str(output)
def serialize_data(self, data, data_type, **kwargs):
"""Serialize generic data according to supplied data type.
- :param data: The data to be serialized.
+ :param object data: The data to be serialized.
:param str data_type: The type to be serialized from.
- :param bool required: Whether it's essential that the data not be
- empty or None
:raises: AttributeError if required data is None.
:raises: ValueError if data is None
:raises: SerializationError if serialization fails.
+ :returns: The serialized data.
+ :rtype: str, int, float, bool, dict, list
"""
if data is None:
raise ValueError("No value for given attribute")
try:
- if data is AzureCoreNull:
+ if data is CoreNull:
return None
if data_type in self.basic_types.values():
return self.serialize_basic(data, data_type, **kwargs)
- elif data_type in self.serialize_type:
+ if data_type in self.serialize_type:
return self.serialize_type[data_type](data, **kwargs)
# If dependencies is empty, try with current data class
@@ -826,12 +884,11 @@ def serialize_data(self, data, data_type, **kwargs):
except (ValueError, TypeError) as err:
msg = "Unable to serialize value: {!r} as type: {!r}."
- raise_with_traceback(SerializationError, msg.format(data, data_type), err)
- else:
- return self._serialize(data, **kwargs)
+ raise SerializationError(msg.format(data, data_type)) from err
+ return self._serialize(data, **kwargs)
@classmethod
- def _get_custom_serializers(cls, data_type, **kwargs):
+ def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements
custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type)
if custom_serializer:
return custom_serializer
@@ -847,23 +904,26 @@ def serialize_basic(cls, data, data_type, **kwargs):
- basic_types_serializers dict[str, callable] : If set, use the callable as serializer
- is_xml bool : If set, use xml_basic_types_serializers
- :param data: Object to be serialized.
+ :param obj data: Object to be serialized.
:param str data_type: Type of object in the iterable.
+ :rtype: str, int, float, bool
+ :return: serialized object
"""
custom_serializer = cls._get_custom_serializers(data_type, **kwargs)
if custom_serializer:
return custom_serializer(data)
if data_type == "str":
return cls.serialize_unicode(data)
- return eval(data_type)(data) # nosec
+ return eval(data_type)(data) # nosec # pylint: disable=eval-used
@classmethod
def serialize_unicode(cls, data):
"""Special handling for serializing unicode strings in Py2.
Encode to UTF-8 if unicode, otherwise handle as a str.
- :param data: Object to be serialized.
+ :param str data: Object to be serialized.
:rtype: str
+ :return: serialized object
"""
try: # If I received an enum, return its value
return data.value
@@ -877,8 +937,7 @@ def serialize_unicode(cls, data):
return data
except NameError:
return str(data)
- else:
- return str(data)
+ return str(data)
def serialize_iter(self, data, iter_type, div=None, **kwargs):
"""Serialize iterable.
@@ -888,15 +947,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
serialization_ctxt['type'] should be same as data_type.
- is_xml bool : If set, serialize as XML
- :param list attr: Object to be serialized.
+ :param list data: Object to be serialized.
:param str iter_type: Type of object in the iterable.
- :param bool required: Whether the objects in the iterable must
- not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
- :keyword bool do_quote: Whether to quote the serialized result of each iterable element.
Defaults to False.
:rtype: list, str
+ :return: serialized iterable
"""
if isinstance(data, str):
raise SerializationError("Refuse str type as a valid iter type.")
@@ -913,12 +970,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
raise
serialized.append(None)
- if kwargs.get('do_quote', False):
- serialized = [
- '' if s is None else quote(str(s), safe='')
- for s
- in serialized
- ]
+ if kwargs.get("do_quote", False):
+ serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
if div:
serialized = ["" if s is None else str(s) for s in serialized]
@@ -955,9 +1008,8 @@ def serialize_dict(self, attr, dict_type, **kwargs):
:param dict attr: Object to be serialized.
:param str dict_type: Type of object in the dictionary.
- :param bool required: Whether the objects in the dictionary must
- not be None or empty.
:rtype: dict
+ :return: serialized dictionary
"""
serialization_ctxt = kwargs.get("serialization_ctxt", {})
serialized = {}
@@ -981,7 +1033,7 @@ def serialize_dict(self, attr, dict_type, **kwargs):
return serialized
- def serialize_object(self, attr, **kwargs):
+ def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements
"""Serialize a generic object.
This will be handled as a dictionary. If object passed in is not
a basic type (str, int, float, dict, list) it will simply be
@@ -989,6 +1041,7 @@ def serialize_object(self, attr, **kwargs):
:param dict attr: Object to be serialized.
:rtype: dict or str
+ :return: serialized object
"""
if attr is None:
return None
@@ -999,7 +1052,7 @@ def serialize_object(self, attr, **kwargs):
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
if obj_type is _long_type:
return self.serialize_long(attr)
- if obj_type is unicode_str:
+ if obj_type is str:
return self.serialize_unicode(attr)
if obj_type is datetime.datetime:
return self.serialize_iso(attr)
@@ -1013,7 +1066,7 @@ def serialize_object(self, attr, **kwargs):
return self.serialize_decimal(attr)
# If it's a model or I know this dependency, serialize as a Model
- elif obj_type in self.dependencies.values() or isinstance(attr, Model):
+ if obj_type in self.dependencies.values() or isinstance(attr, Model):
return self._serialize(attr)
if obj_type == dict:
@@ -1044,56 +1097,61 @@ def serialize_enum(attr, enum_obj=None):
try:
enum_obj(result) # type: ignore
return result
- except ValueError:
+ except ValueError as exc:
for enum_value in enum_obj: # type: ignore
if enum_value.value.lower() == str(attr).lower():
return enum_value.value
error = "{!r} is not valid value for enum {!r}"
- raise SerializationError(error.format(attr, enum_obj))
+ raise SerializationError(error.format(attr, enum_obj)) from exc
@staticmethod
- def serialize_bytearray(attr, **kwargs):
+ def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize bytearray into base-64 string.
- :param attr: Object to be serialized.
+ :param str attr: Object to be serialized.
:rtype: str
+ :return: serialized base64
"""
return b64encode(attr).decode()
@staticmethod
- def serialize_base64(attr, **kwargs):
+ def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize str into base-64 string.
- :param attr: Object to be serialized.
+ :param str attr: Object to be serialized.
:rtype: str
+ :return: serialized base64
"""
encoded = b64encode(attr).decode("ascii")
return encoded.strip("=").replace("+", "-").replace("/", "_")
@staticmethod
- def serialize_decimal(attr, **kwargs):
+ def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize Decimal object to float.
- :param attr: Object to be serialized.
+ :param decimal attr: Object to be serialized.
:rtype: float
+ :return: serialized decimal
"""
return float(attr)
@staticmethod
- def serialize_long(attr, **kwargs):
+ def serialize_long(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize long (Py2) or int (Py3).
- :param attr: Object to be serialized.
+ :param int attr: Object to be serialized.
:rtype: int/long
+ :return: serialized long
"""
return _long_type(attr)
@staticmethod
- def serialize_date(attr, **kwargs):
+ def serialize_date(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize Date object into ISO-8601 formatted string.
:param Date attr: Object to be serialized.
:rtype: str
+ :return: serialized date
"""
if isinstance(attr, str):
attr = isodate.parse_date(attr)
@@ -1101,11 +1159,12 @@ def serialize_date(attr, **kwargs):
return t
@staticmethod
- def serialize_time(attr, **kwargs):
+ def serialize_time(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize Time object into ISO-8601 formatted string.
:param datetime.time attr: Object to be serialized.
:rtype: str
+ :return: serialized time
"""
if isinstance(attr, str):
attr = isodate.parse_time(attr)
@@ -1115,30 +1174,32 @@ def serialize_time(attr, **kwargs):
return t
@staticmethod
- def serialize_duration(attr, **kwargs):
+ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize TimeDelta object into ISO-8601 formatted string.
:param TimeDelta attr: Object to be serialized.
:rtype: str
+ :return: serialized duration
"""
if isinstance(attr, str):
attr = isodate.parse_duration(attr)
return isodate.duration_isoformat(attr)
@staticmethod
- def serialize_rfc(attr, **kwargs):
+ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize Datetime object into RFC-1123 formatted string.
:param Datetime attr: Object to be serialized.
:rtype: str
:raises: TypeError if format invalid.
+ :return: serialized rfc
"""
try:
if not attr.tzinfo:
_LOGGER.warning("Datetime with no tzinfo will be considered UTC.")
utc = attr.utctimetuple()
- except AttributeError:
- raise TypeError("RFC1123 object must be valid Datetime object.")
+ except AttributeError as exc:
+ raise TypeError("RFC1123 object must be valid Datetime object.") from exc
return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format(
Serializer.days[utc.tm_wday],
@@ -1151,12 +1212,13 @@ def serialize_rfc(attr, **kwargs):
)
@staticmethod
- def serialize_iso(attr, **kwargs):
+ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize Datetime object into ISO-8601 formatted string.
:param Datetime attr: Object to be serialized.
:rtype: str
:raises: SerializationError if format invalid.
+ :return: serialized iso
"""
if isinstance(attr, str):
attr = isodate.parse_datetime(attr)
@@ -1176,19 +1238,20 @@ def serialize_iso(attr, **kwargs):
return date + microseconds + "Z"
except (ValueError, OverflowError) as err:
msg = "Unable to serialize datetime object."
- raise_with_traceback(SerializationError, msg, err)
+ raise SerializationError(msg) from err
except AttributeError as err:
msg = "ISO-8601 object must be valid Datetime object."
- raise_with_traceback(TypeError, msg, err)
+ raise TypeError(msg) from err
@staticmethod
- def serialize_unix(attr, **kwargs):
+ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument
"""Serialize Datetime object into IntTime format.
This is represented as seconds.
:param Datetime attr: Object to be serialized.
:rtype: int
:raises: SerializationError if format invalid
+ :return: serialied unix
"""
if isinstance(attr, int):
return attr
@@ -1196,11 +1259,11 @@ def serialize_unix(attr, **kwargs):
if not attr.tzinfo:
_LOGGER.warning("Datetime with no tzinfo will be considered UTC.")
return int(calendar.timegm(attr.utctimetuple()))
- except AttributeError:
- raise TypeError("Unix time object must be valid Datetime object.")
+ except AttributeError as exc:
+ raise TypeError("Unix time object must be valid Datetime object.") from exc
-def rest_key_extractor(attr, attr_desc, data):
+def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument
key = attr_desc["key"]
working_data = data
@@ -1215,14 +1278,15 @@ def rest_key_extractor(attr, attr_desc, data):
if working_data is None:
# If at any point while following flatten JSON path see None, it means
# that all properties under are None as well
- # https://github.com/Azure/msrest-for-python/issues/197
return None
key = ".".join(dict_keys[1:])
return working_data.get(key)
-def rest_key_case_insensitive_extractor(attr, attr_desc, data):
+def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements
+ attr, attr_desc, data
+):
key = attr_desc["key"]
working_data = data
@@ -1236,7 +1300,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data):
if working_data is None:
# If at any point while following flatten JSON path see None, it means
# that all properties under are None as well
- # https://github.com/Azure/msrest-for-python/issues/197
return None
key = ".".join(dict_keys[1:])
@@ -1244,17 +1307,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data):
return attribute_key_case_insensitive_extractor(key, None, working_data)
-def last_rest_key_extractor(attr, attr_desc, data):
- """Extract the attribute in "data" based on the last part of the JSON path key."""
+def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument
+ """Extract the attribute in "data" based on the last part of the JSON path key.
+
+ :param str attr: The attribute to extract
+ :param dict attr_desc: The attribute description
+ :param dict data: The data to extract from
+ :rtype: object
+ :returns: The extracted attribute
+ """
key = attr_desc["key"]
dict_keys = _FLATTEN.split(key)
return attribute_key_extractor(dict_keys[-1], None, data)
-def last_rest_key_case_insensitive_extractor(attr, attr_desc, data):
+def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument
"""Extract the attribute in "data" based on the last part of the JSON path key.
This is the case insensitive version of "last_rest_key_extractor"
+ :param str attr: The attribute to extract
+ :param dict attr_desc: The attribute description
+ :param dict data: The data to extract from
+ :rtype: object
+ :returns: The extracted attribute
"""
key = attr_desc["key"]
dict_keys = _FLATTEN.split(key)
@@ -1291,7 +1366,7 @@ def _extract_name_from_internal_type(internal_type):
return xml_name
-def xml_key_extractor(attr, attr_desc, data):
+def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements
if isinstance(data, dict):
return None
@@ -1343,22 +1418,21 @@ def xml_key_extractor(attr, attr_desc, data):
if is_iter_type:
if is_wrapped:
return None # is_wrapped no node, we want None
- else:
- return [] # not wrapped, assume empty list
+ return [] # not wrapped, assume empty list
return None # Assume it's not there, maybe an optional node.
# If is_iter_type and not wrapped, return all found children
if is_iter_type:
if not is_wrapped:
return children
- else: # Iter and wrapped, should have found one node only (the wrap one)
- if len(children) != 1:
- raise DeserializationError(
- "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format(
- xml_name
- )
+ # Iter and wrapped, should have found one node only (the wrap one)
+ if len(children) != 1:
+ raise DeserializationError(
+ "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long
+ xml_name
)
- return list(children[0]) # Might be empty list and that's ok.
+ )
+ return list(children[0]) # Might be empty list and that's ok.
# Here it's not a itertype, we should have found one element only or empty
if len(children) > 1:
@@ -1375,9 +1449,9 @@ class Deserializer(object):
basic_types = {str: "str", int: "int", bool: "bool", float: "float"}
- valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
+ valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
- def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None):
+ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None:
self.deserialize_type = {
"iso-8601": Deserializer.deserialize_iso,
"rfc-1123": Deserializer.deserialize_rfc,
@@ -1397,7 +1471,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None):
"duration": (isodate.Duration, datetime.timedelta),
"iso-8601": (datetime.datetime),
}
- self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
+ self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_extractors = [rest_key_extractor, xml_key_extractor]
# Additional properties only works if the "rest_key_extractor" is used to
# extract the keys. Making it to work whatever the key extractor is too much
@@ -1415,11 +1489,12 @@ def __call__(self, target_obj, response_data, content_type=None):
:param str content_type: Swagger "produces" if available.
:raises: DeserializationError if deserialization fails.
:return: Deserialized object.
+ :rtype: object
"""
data = self._unpack_content(response_data, content_type)
return self._deserialize(target_obj, data)
- def _deserialize(self, target_obj, data):
+ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements
"""Call the deserializer on a model.
Data needs to be already deserialized as JSON or XML ElementTree
@@ -1428,12 +1503,13 @@ def _deserialize(self, target_obj, data):
:param object data: Object to deserialize.
:raises: DeserializationError if deserialization fails.
:return: Deserialized object.
+ :rtype: object
"""
# This is already a model, go recursive just in case
if hasattr(data, "_attribute_map"):
constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")]
try:
- for attr, mapconfig in data._attribute_map.items():
+ for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access
if attr in constants:
continue
value = getattr(data, attr)
@@ -1450,15 +1526,15 @@ def _deserialize(self, target_obj, data):
response, class_name = self._classify_target(target_obj, data)
- if isinstance(response, basestring):
+ if isinstance(response, str):
return self.deserialize_data(data, response)
- elif isinstance(response, type) and issubclass(response, Enum):
+ if isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
- if data is None:
+ if data is None or data is CoreNull:
return data
try:
- attributes = response._attribute_map # type: ignore
+ attributes = response._attribute_map # type: ignore # pylint: disable=protected-access
d_attrs = {}
for attr, attr_desc in attributes.items():
# Check empty string. If it's not empty, someone has a real "additionalProperties"...
@@ -1487,10 +1563,9 @@ def _deserialize(self, target_obj, data):
d_attrs[attr] = value
except (AttributeError, TypeError, KeyError) as err:
msg = "Unable to deserialize to object: " + class_name # type: ignore
- raise_with_traceback(DeserializationError, msg, err)
- else:
- additional_properties = self._build_additional_properties(attributes, data)
- return self._instantiate_model(response, d_attrs, additional_properties)
+ raise DeserializationError(msg) from err
+ 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:
@@ -1517,18 +1592,20 @@ def _classify_target(self, target, data):
:param str target: The target object type to deserialize to.
:param str/dict data: The response data to deserialize.
+ :return: The classified target object and its class name.
+ :rtype: tuple
"""
if target is None:
return None, None
- if isinstance(target, basestring):
+ if isinstance(target, str):
try:
target = self.dependencies[target]
except KeyError:
return target, target
try:
- target = target._classify(data, self.dependencies)
+ target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access
except AttributeError:
pass # Target is not a Model, no classify
return target, target.__class__.__name__ # type: ignore
@@ -1543,10 +1620,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None):
:param str target_obj: The target object type to deserialize to.
:param str/dict data: The response data to deserialize.
:param str content_type: Swagger "produces" if available.
+ :return: Deserialized object.
+ :rtype: object
"""
try:
return self(target_obj, data, content_type=content_type)
- except:
+ except: # pylint: disable=bare-except
_LOGGER.debug(
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
)
@@ -1564,10 +1643,12 @@ def _unpack_content(raw_data, content_type=None):
If raw_data is something else, bypass all logic and return it directly.
- :param raw_data: Data to be processed.
- :param content_type: How to parse if raw_data is a string/bytes.
+ :param obj raw_data: Data to be processed.
+ :param str content_type: How to parse if raw_data is a string/bytes.
:raises JSONDecodeError: If JSON is requested and parsing is impossible.
:raises UnicodeDecodeError: If bytes is not UTF8
+ :rtype: object
+ :return: Unpacked content.
"""
# Assume this is enough to detect a Pipeline Response without importing it
context = getattr(raw_data, "context", {})
@@ -1584,21 +1665,28 @@ def _unpack_content(raw_data, content_type=None):
if hasattr(raw_data, "_content_consumed"):
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
- if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
+ if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
return raw_data
def _instantiate_model(self, response, attrs, additional_properties=None):
"""Instantiate a response model passing in deserialized args.
- :param response: The response model class.
- :param d_attrs: The deserialized response attributes.
+ :param Response response: The response model class.
+ :param dict attrs: The deserialized response attributes.
+ :param dict additional_properties: Additional properties to be set.
+ :rtype: Response
+ :return: The instantiated response model.
"""
if callable(response):
subtype = getattr(response, "_subtype_map", {})
try:
- readonly = [k for k, v in response._validation.items() if v.get("readonly")]
- const = [k for k, v in response._validation.items() if v.get("constant")]
+ readonly = [
+ k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access
+ ]
+ const = [
+ k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access
+ ]
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:
@@ -1608,7 +1696,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None):
return response_obj
except TypeError as err:
msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore
- raise DeserializationError(msg + str(err))
+ raise DeserializationError(msg + str(err)) from err
else:
try:
for attr, value in attrs.items():
@@ -1617,15 +1705,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None):
except Exception as exp:
msg = "Unable to populate response model. "
msg += "Type: {}, Error: {}".format(type(response), exp)
- raise DeserializationError(msg)
+ raise DeserializationError(msg) from exp
- def deserialize_data(self, data, data_type):
+ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements
"""Process data for deserialization according to data type.
:param str data: The response string to be deserialized.
:param str data_type: The type to deserialize to.
:raises: DeserializationError if deserialization fails.
:return: Deserialized object.
+ :rtype: object
"""
if data is None:
return data
@@ -1639,7 +1728,11 @@ def deserialize_data(self, data, data_type):
if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())):
return data
- is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"]
+ is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment
+ "object",
+ "[]",
+ r"{}",
+ ]
if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text:
return None
data_val = self.deserialize_type[data_type](data)
@@ -1658,15 +1751,15 @@ def deserialize_data(self, data, data_type):
except (ValueError, TypeError, AttributeError) as err:
msg = "Unable to deserialize response data."
msg += " Data: {}, {}".format(data, data_type)
- raise_with_traceback(DeserializationError, msg, err)
- else:
- return self._deserialize(obj_type, data)
+ raise DeserializationError(msg) from err
+ return self._deserialize(obj_type, data)
def deserialize_iter(self, attr, iter_type):
"""Deserialize an iterable.
:param list attr: Iterable to be deserialized.
:param str iter_type: The type of object in the iterable.
+ :return: Deserialized iterable.
:rtype: list
"""
if attr is None:
@@ -1683,6 +1776,7 @@ def deserialize_dict(self, attr, dict_type):
:param dict/list attr: Dictionary to be deserialized. Also accepts
a list of key, value pairs.
:param str dict_type: The object type of the items in the dictionary.
+ :return: Deserialized dictionary.
:rtype: dict
"""
if isinstance(attr, list):
@@ -1693,11 +1787,12 @@ def deserialize_dict(self, attr, dict_type):
attr = {el.tag: el.text for el in attr}
return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()}
- def deserialize_object(self, attr, **kwargs):
+ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements
"""Deserialize a generic object.
This will be handled as a dictionary.
:param dict attr: Dictionary to be deserialized.
+ :return: Deserialized object.
:rtype: dict
:raises: TypeError if non-builtin datatype encountered.
"""
@@ -1706,7 +1801,7 @@ def deserialize_object(self, attr, **kwargs):
if isinstance(attr, ET.Element):
# Do no recurse on XML, just return the tree as-is
return attr
- if isinstance(attr, basestring):
+ if isinstance(attr, str):
return self.deserialize_basic(attr, "str")
obj_type = type(attr)
if obj_type in self.basic_types:
@@ -1732,11 +1827,10 @@ def deserialize_object(self, attr, **kwargs):
pass
return deserialized
- else:
- error = "Cannot deserialize generic object with type: "
- raise TypeError(error + str(obj_type))
+ error = "Cannot deserialize generic object with type: "
+ raise TypeError(error + str(obj_type))
- def deserialize_basic(self, attr, data_type):
+ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements
"""Deserialize basic builtin data type from string.
Will attempt to convert to str, int, float and bool.
This function will also accept '1', '0', 'true' and 'false' as
@@ -1744,6 +1838,7 @@ def deserialize_basic(self, attr, data_type):
:param str attr: response string to be deserialized.
:param str data_type: deserialization data type.
+ :return: Deserialized basic type.
:rtype: str, int, float or bool
:raises: TypeError if string format is not valid.
"""
@@ -1755,24 +1850,23 @@ def deserialize_basic(self, attr, data_type):
if data_type == "str":
# None or '', node is empty string.
return ""
- else:
- # None or '', node with a strong type is None.
- # Don't try to model "empty bool" or "empty int"
- return None
+ # None or '', node with a strong type is None.
+ # Don't try to model "empty bool" or "empty int"
+ return None
if data_type == "bool":
if attr in [True, False, 1, 0]:
return bool(attr)
- elif isinstance(attr, basestring):
+ if isinstance(attr, str):
if attr.lower() in ["true", "1"]:
return True
- elif attr.lower() in ["false", "0"]:
+ if attr.lower() in ["false", "0"]:
return False
raise TypeError("Invalid boolean value: {}".format(attr))
if data_type == "str":
return self.deserialize_unicode(attr)
- return eval(data_type)(attr) # nosec
+ return eval(data_type)(attr) # nosec # pylint: disable=eval-used
@staticmethod
def deserialize_unicode(data):
@@ -1780,6 +1874,7 @@ def deserialize_unicode(data):
as a string.
:param str data: response string to be deserialized.
+ :return: Deserialized string.
:rtype: str or unicode
"""
# We might be here because we have an enum modeled as string,
@@ -1793,8 +1888,7 @@ def deserialize_unicode(data):
return data
except NameError:
return str(data)
- else:
- return str(data)
+ return str(data)
@staticmethod
def deserialize_enum(data, enum_obj):
@@ -1806,6 +1900,7 @@ def deserialize_enum(data, enum_obj):
:param str data: Response string to be deserialized. If this value is
None or invalid it will be returned as-is.
:param Enum enum_obj: Enum object to deserialize to.
+ :return: Deserialized enum object.
:rtype: Enum
"""
if isinstance(data, enum_obj) or data is None:
@@ -1814,12 +1909,11 @@ def deserialize_enum(data, enum_obj):
data = data.value
if isinstance(data, int):
# Workaround. We might consider remove it in the future.
- # https://github.com/Azure/azure-rest-api-specs/issues/141
try:
return list(enum_obj.__members__.values())[data]
- except IndexError:
+ except IndexError as exc:
error = "{!r} is not a valid index for enum {!r}"
- raise DeserializationError(error.format(data, enum_obj))
+ raise DeserializationError(error.format(data, enum_obj)) from exc
try:
return enum_obj(str(data))
except ValueError:
@@ -1835,6 +1929,7 @@ def deserialize_bytearray(attr):
"""Deserialize string into bytearray.
:param str attr: response string to be deserialized.
+ :return: Deserialized bytearray
:rtype: bytearray
:raises: TypeError if string format invalid.
"""
@@ -1847,6 +1942,7 @@ def deserialize_base64(attr):
"""Deserialize base64 encoded string into string.
:param str attr: response string to be deserialized.
+ :return: Deserialized base64 string
:rtype: bytearray
:raises: TypeError if string format invalid.
"""
@@ -1862,22 +1958,24 @@ def deserialize_decimal(attr):
"""Deserialize string into Decimal object.
:param str attr: response string to be deserialized.
- :rtype: Decimal
+ :return: Deserialized decimal
:raises: DeserializationError if string format invalid.
+ :rtype: decimal
"""
if isinstance(attr, ET.Element):
attr = attr.text
try:
- return decimal.Decimal(attr) # type: ignore
+ return decimal.Decimal(str(attr)) # type: ignore
except decimal.DecimalException as err:
msg = "Invalid decimal {}".format(attr)
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
@staticmethod
def deserialize_long(attr):
"""Deserialize string into long (Py2) or int (Py3).
:param str attr: response string to be deserialized.
+ :return: Deserialized int
:rtype: long or int
:raises: ValueError if string format invalid.
"""
@@ -1890,6 +1988,7 @@ def deserialize_duration(attr):
"""Deserialize ISO-8601 formatted string into TimeDelta object.
:param str attr: response string to be deserialized.
+ :return: Deserialized duration
:rtype: TimeDelta
:raises: DeserializationError if string format invalid.
"""
@@ -1899,15 +1998,15 @@ def deserialize_duration(attr):
duration = isodate.parse_duration(attr)
except (ValueError, OverflowError, AttributeError) as err:
msg = "Cannot deserialize duration object."
- raise_with_traceback(DeserializationError, msg, err)
- else:
- return duration
+ raise DeserializationError(msg) from err
+ return duration
@staticmethod
def deserialize_date(attr):
"""Deserialize ISO-8601 formatted string into Date object.
:param str attr: response string to be deserialized.
+ :return: Deserialized date
:rtype: Date
:raises: DeserializationError if string format invalid.
"""
@@ -1916,13 +2015,14 @@ def deserialize_date(attr):
if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore
raise DeserializationError("Date must have only digits and -. Received: %s" % attr)
# This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception.
- return isodate.parse_date(attr, defaultmonth=None, defaultday=None)
+ return isodate.parse_date(attr, defaultmonth=0, defaultday=0)
@staticmethod
def deserialize_time(attr):
"""Deserialize ISO-8601 formatted string into time object.
:param str attr: response string to be deserialized.
+ :return: Deserialized time
:rtype: datetime.time
:raises: DeserializationError if string format invalid.
"""
@@ -1937,6 +2037,7 @@ def deserialize_rfc(attr):
"""Deserialize RFC-1123 formatted string into Datetime object.
:param str attr: response string to be deserialized.
+ :return: Deserialized RFC datetime
:rtype: Datetime
:raises: DeserializationError if string format invalid.
"""
@@ -1951,15 +2052,15 @@ def deserialize_rfc(attr):
date_obj = date_obj.astimezone(tz=TZ_UTC)
except ValueError as err:
msg = "Cannot deserialize to rfc datetime object."
- raise_with_traceback(DeserializationError, msg, err)
- else:
- return date_obj
+ raise DeserializationError(msg) from err
+ return date_obj
@staticmethod
def deserialize_iso(attr):
"""Deserialize ISO-8601 formatted string into Datetime object.
:param str attr: response string to be deserialized.
+ :return: Deserialized ISO datetime
:rtype: Datetime
:raises: DeserializationError if string format invalid.
"""
@@ -1988,9 +2089,8 @@ def deserialize_iso(attr):
raise OverflowError("Hit max or min date")
except (ValueError, OverflowError, AttributeError) as err:
msg = "Cannot deserialize datetime object."
- raise_with_traceback(DeserializationError, msg, err)
- else:
- return date_obj
+ raise DeserializationError(msg) from err
+ return date_obj
@staticmethod
def deserialize_unix(attr):
@@ -1998,15 +2098,16 @@ def deserialize_unix(attr):
This is represented as seconds.
:param int attr: Object to be serialized.
+ :return: Deserialized datetime
:rtype: Datetime
:raises: DeserializationError if format invalid
"""
if isinstance(attr, ET.Element):
attr = int(attr.text) # type: ignore
try:
+ attr = int(attr)
date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC)
except ValueError as err:
msg = "Cannot deserialize to unix datetime object."
- raise_with_traceback(DeserializationError, msg, err)
- else:
- return date_obj
+ raise DeserializationError(msg) from err
+ return date_obj
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py
index fc4b01f2b29e0..aaa89da48017b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py
@@ -10,8 +10,11 @@
# --------------------------------------------------------------------------
from typing import Any, Optional, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
@@ -81,7 +84,25 @@ def __init__(
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs)
- self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
super(SourceControlConfigurationClient, self).__init__(
api_version=api_version,
profile=profile
@@ -108,6 +129,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2022-07-01: :mod:`v2022_07_01.models`
* 2022-11-01: :mod:`v2022_11_01.models`
* 2023-05-01: :mod:`v2023_05_01.models`
+ * 2024-04-01-preview: :mod:`v2024_04_01_preview.models`
"""
if api_version == '2020-07-01-preview':
from .v2020_07_01_preview import models
@@ -148,6 +170,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2023-05-01':
from .v2023_05_01 import models
return models
+ elif api_version == '2024-04-01-preview':
+ from .v2024_04_01_preview import models
+ return models
raise ValueError("API version {} is not available".format(api_version))
@property
@@ -270,6 +295,7 @@ def flux_config_operation_status(self):
* 2022-07-01: :class:`FluxConfigOperationStatusOperations`
* 2022-11-01: :class:`FluxConfigOperationStatusOperations`
* 2023-05-01: :class:`FluxConfigOperationStatusOperations`
+ * 2024-04-01-preview: :class:`FluxConfigOperationStatusOperations`
"""
api_version = self._get_api_version('flux_config_operation_status')
if api_version == '2021-11-01-preview':
@@ -284,6 +310,8 @@ def flux_config_operation_status(self):
from .v2022_11_01.operations import FluxConfigOperationStatusOperations as OperationClass
elif api_version == '2023-05-01':
from .v2023_05_01.operations import FluxConfigOperationStatusOperations as OperationClass
+ elif api_version == '2024-04-01-preview':
+ from .v2024_04_01_preview.operations import FluxConfigOperationStatusOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'flux_config_operation_status'".format(api_version))
self._config.api_version = api_version
@@ -299,6 +327,7 @@ def flux_configurations(self):
* 2022-07-01: :class:`FluxConfigurationsOperations`
* 2022-11-01: :class:`FluxConfigurationsOperations`
* 2023-05-01: :class:`FluxConfigurationsOperations`
+ * 2024-04-01-preview: :class:`FluxConfigurationsOperations`
"""
api_version = self._get_api_version('flux_configurations')
if api_version == '2021-11-01-preview':
@@ -313,6 +342,8 @@ def flux_configurations(self):
from .v2022_11_01.operations import FluxConfigurationsOperations as OperationClass
elif api_version == '2023-05-01':
from .v2023_05_01.operations import FluxConfigurationsOperations as OperationClass
+ elif api_version == '2024-04-01-preview':
+ from .v2024_04_01_preview.operations import FluxConfigurationsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'flux_configurations'".format(api_version))
self._config.api_version = api_version
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py
index f1676e683a70d..3ebf32f82acf0 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py
@@ -10,7 +10,6 @@
# --------------------------------------------------------------------------
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
@@ -20,7 +19,7 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration):
+class SourceControlConfigurationClientConfiguration:
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -42,12 +41,12 @@ def __init__(
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-kubernetesconfiguration/{}'.format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py
index 26722aeb3d63c..800b5dacea89c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py
@@ -10,8 +10,11 @@
# --------------------------------------------------------------------------
from typing import Any, Optional, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
@@ -81,7 +84,25 @@ def __init__(
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs)
- self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
super(SourceControlConfigurationClient, self).__init__(
api_version=api_version,
profile=profile
@@ -108,6 +129,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2022-07-01: :mod:`v2022_07_01.models`
* 2022-11-01: :mod:`v2022_11_01.models`
* 2023-05-01: :mod:`v2023_05_01.models`
+ * 2024-04-01-preview: :mod:`v2024_04_01_preview.models`
"""
if api_version == '2020-07-01-preview':
from ..v2020_07_01_preview import models
@@ -148,6 +170,9 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2023-05-01':
from ..v2023_05_01 import models
return models
+ elif api_version == '2024-04-01-preview':
+ from ..v2024_04_01_preview import models
+ return models
raise ValueError("API version {} is not available".format(api_version))
@property
@@ -270,6 +295,7 @@ def flux_config_operation_status(self):
* 2022-07-01: :class:`FluxConfigOperationStatusOperations`
* 2022-11-01: :class:`FluxConfigOperationStatusOperations`
* 2023-05-01: :class:`FluxConfigOperationStatusOperations`
+ * 2024-04-01-preview: :class:`FluxConfigOperationStatusOperations`
"""
api_version = self._get_api_version('flux_config_operation_status')
if api_version == '2021-11-01-preview':
@@ -284,6 +310,8 @@ def flux_config_operation_status(self):
from ..v2022_11_01.aio.operations import FluxConfigOperationStatusOperations as OperationClass
elif api_version == '2023-05-01':
from ..v2023_05_01.aio.operations import FluxConfigOperationStatusOperations as OperationClass
+ elif api_version == '2024-04-01-preview':
+ from ..v2024_04_01_preview.aio.operations import FluxConfigOperationStatusOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'flux_config_operation_status'".format(api_version))
self._config.api_version = api_version
@@ -299,6 +327,7 @@ def flux_configurations(self):
* 2022-07-01: :class:`FluxConfigurationsOperations`
* 2022-11-01: :class:`FluxConfigurationsOperations`
* 2023-05-01: :class:`FluxConfigurationsOperations`
+ * 2024-04-01-preview: :class:`FluxConfigurationsOperations`
"""
api_version = self._get_api_version('flux_configurations')
if api_version == '2021-11-01-preview':
@@ -313,6 +342,8 @@ def flux_configurations(self):
from ..v2022_11_01.aio.operations import FluxConfigurationsOperations as OperationClass
elif api_version == '2023-05-01':
from ..v2023_05_01.aio.operations import FluxConfigurationsOperations as OperationClass
+ elif api_version == '2024-04-01-preview':
+ from ..v2024_04_01_preview.aio.operations import FluxConfigurationsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'flux_configurations'".format(api_version))
self._config.api_version = api_version
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_configuration.py
index 82cdce24b9b04..a4c669a2654d9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -36,7 +34,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-07-01-preview")
if credential is None:
@@ -49,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -57,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json
index f75b4c9e24133..5d86c48342773 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"source_control_configurations": "SourceControlConfigurationsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py
index 44b745eea0bad..9c9fce9358d43 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import ExtensionsOperations, Operations, SourceControlConfigurationsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar source_control_configurations: SourceControlConfigurationsOperations operations
@@ -58,7 +60,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -74,7 +94,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -94,12 +114,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_configuration.py
index ad230508223fc..76c7d6c09a328 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -36,7 +34,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-07-01-preview")
if credential is None:
@@ -49,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -57,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py
index 785a1cc9da874..98444929679f7 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import ExtensionsOperations, Operations, SourceControlConfigurationsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar source_control_configurations: SourceControlConfigurationsOperations operations
@@ -58,7 +60,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -74,7 +94,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -94,12 +116,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/__init__.py
index 4a64188d9a661..87a0bf0894aec 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/__init__.py
@@ -5,13 +5,19 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
-from ._extensions_operations import ExtensionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._extensions_operations import ExtensionsOperations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -19,5 +25,5 @@
"Operations",
"ExtensionsOperations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_operations.py
index 4b1c993ad1ef2..098dd7a15fb31 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
+import sys
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
@@ -20,15 +20,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -37,6 +35,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -97,7 +99,6 @@ async def create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -111,7 +112,7 @@ async def create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: IO,
+ extension_instance: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -134,11 +135,10 @@ async def create(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties necessary to Create an Extension Instance. Required.
- :type extension_instance: IO
+ :type extension_instance: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -152,7 +152,7 @@ async def create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: Union[_models.ExtensionInstance, IO],
+ extension_instance: Union[_models.ExtensionInstance, IO[bytes]],
**kwargs: Any
) -> _models.ExtensionInstance:
"""Create a new Kubernetes Cluster Extension Instance.
@@ -173,18 +173,14 @@ async def create(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties necessary to Create an Extension Instance. Is either a
- ExtensionInstance type or a IO type. Required.
+ ExtensionInstance type or a IO[bytes] type. Required.
:type extension_instance:
- ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance or IO[bytes]
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -209,7 +205,7 @@ async def create(
else:
_json = self._serialize.body(extension_instance, "ExtensionInstance")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -220,16 +216,14 @@ async def create(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -239,16 +233,12 @@ async def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionInstance", pipeline_response)
+ deserialized = self._deserialize("ExtensionInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -277,12 +267,11 @@ async def get(
:type cluster_name: str
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -298,7 +287,7 @@ async def get(
)
cls: ClsType[_models.ExtensionInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -306,16 +295,14 @@ async def get(
extension_instance_name=extension_instance_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -325,16 +312,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionInstance", pipeline_response)
+ deserialized = self._deserialize("ExtensionInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return deserialized # type: ignore
@overload
async def update(
@@ -372,7 +355,6 @@ async def update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -386,7 +368,7 @@ async def update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: IO,
+ extension_instance: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -409,11 +391,10 @@ async def update(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties to Update in the Extension Instance. Required.
- :type extension_instance: IO
+ :type extension_instance: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -427,7 +408,7 @@ async def update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: Union[_models.ExtensionInstanceUpdate, IO],
+ extension_instance: Union[_models.ExtensionInstanceUpdate, IO[bytes]],
**kwargs: Any
) -> _models.ExtensionInstance:
"""Update an existing Kubernetes Cluster Extension Instance.
@@ -448,18 +429,15 @@ async def update(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties to Update in the Extension Instance. Is either a
- ExtensionInstanceUpdate type or a IO type. Required.
+ ExtensionInstanceUpdate type or a IO[bytes] type. Required.
:type extension_instance:
- ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate or
+ IO[bytes]
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -484,7 +462,7 @@ async def update(
else:
_json = self._serialize.body(extension_instance, "ExtensionInstanceUpdate")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -495,16 +473,14 @@ async def update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -514,19 +490,15 @@ async def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionInstance", pipeline_response)
+ deserialized = self._deserialize("ExtensionInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def delete(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -553,12 +525,11 @@ async def delete( # pylint: disable=inconsistent-return-statements
:type cluster_name: str
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_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 = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -574,7 +545,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -582,16 +553,14 @@ async def delete( # pylint: disable=inconsistent-return-statements
extension_instance_name=extension_instance_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -602,11 +571,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list(
@@ -617,6 +582,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.ExtensionInstance"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. Required.
@@ -632,7 +598,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionInstance or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance]
@@ -646,7 +611,7 @@ def list(
)
cls: ClsType[_models.ExtensionInstancesList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,19 +622,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -680,14 +643,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionInstancesList", pipeline_response)
@@ -697,11 +659,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -713,7 +675,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_operations.py
index c37dbe27b80b7..67051827532b5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -72,7 +74,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,14 +85,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -101,14 +101,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -118,11 +117,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,5 +133,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py
index 7c503b14115ba..fc9f7bf2bd505 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -89,13 +93,12 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -111,7 +114,7 @@ async def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -119,16 +122,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -138,16 +139,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -186,7 +183,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
@@ -201,7 +197,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -225,11 +221,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
@@ -244,7 +239,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -265,19 +260,16 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -302,7 +294,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -313,16 +305,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -332,22 +322,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -355,8 +337,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -370,9 +352,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -380,31 +362,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -434,14 +419,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -457,7 +434,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -469,11 +446,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -482,17 +460,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -503,6 +477,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. Required.
@@ -518,7 +493,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -533,7 +507,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -544,19 +518,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -567,14 +539,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -584,11 +555,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -600,7 +571,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py
index be8eb15cab787..d5322616769e9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py
@@ -5,41 +5,52 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ConfigurationIdentity
-from ._models_py3 import ErrorDefinition
-from ._models_py3 import ErrorResponse
-from ._models_py3 import ExtensionInstance
-from ._models_py3 import ExtensionInstanceUpdate
-from ._models_py3 import ExtensionInstancesList
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import ProxyResource
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Result
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import Enum0
-from ._source_control_configuration_client_enums import Enum1
-from ._source_control_configuration_client_enums import InstallStateType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningStateType
-from ._source_control_configuration_client_enums import ResourceIdentityType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ComplianceStatus,
+ ConfigurationIdentity,
+ ErrorDefinition,
+ ErrorResponse,
+ ExtensionInstance,
+ ExtensionInstanceUpdate,
+ ExtensionInstancesList,
+ ExtensionStatus,
+ HelmOperatorProperties,
+ ProxyResource,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Result,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ ComplianceStateType,
+ Enum0,
+ Enum1,
+ InstallStateType,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningStateType,
+ ResourceIdentityType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -75,5 +86,5 @@
"ProvisioningStateType",
"ResourceIdentityType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py
index 4434fb0db6e54..aa098fed1e2e1 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py
@@ -1,5 +1,4 @@
# 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.
@@ -13,7 +12,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -118,7 +116,7 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]]
class ErrorDefinition(_serialization.Model):
"""Error definition.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar code: Service specific error code which serves as the substatus for the HTTP error code.
Required.
@@ -185,7 +183,7 @@ class Resource(_serialization.Model):
:ivar type: Resource type.
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
"""
@@ -205,7 +203,7 @@ class Resource(_serialization.Model):
def __init__(self, *, system_data: Optional["_models.SystemData"] = None, **kwargs: Any) -> None:
"""
:keyword system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:paramtype system_data:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
"""
@@ -228,34 +226,12 @@ class ProxyResource(Resource):
:ivar type: Resource type.
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
"""
- _validation = {
- "id": {"readonly": True},
- "name": {"readonly": True},
- "type": {"readonly": True},
- }
-
- _attribute_map = {
- "id": {"key": "id", "type": "str"},
- "name": {"key": "name", "type": "str"},
- "type": {"key": "type", "type": "str"},
- "system_data": {"key": "systemData", "type": "SystemData"},
- }
-
- def __init__(self, *, system_data: Optional["_models.SystemData"] = None, **kwargs: Any) -> None:
- """
- :keyword system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
- :paramtype system_data:
- ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
- """
- super().__init__(system_data=system_data, **kwargs)
-
-class ExtensionInstance(ProxyResource): # pylint: disable=too-many-instance-attributes
+class ExtensionInstance(ProxyResource):
"""The Extension Instance object.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -267,7 +243,7 @@ class ExtensionInstance(ProxyResource): # pylint: disable=too-many-instance-att
:ivar type: Resource type.
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
:ivar extension_type: Type of the Extension, of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the
@@ -363,7 +339,7 @@ def __init__(
) -> None:
"""
:keyword system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:paramtype system_data:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
:keyword extension_type: Type of the Extension, of which this resource is an instance of. It
@@ -788,7 +764,7 @@ def __init__(self, *, target_namespace: Optional[str] = None, **kwargs: Any) ->
self.target_namespace = target_namespace
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -800,7 +776,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
:ivar type: Resource type.
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
@@ -889,7 +865,7 @@ def __init__(
) -> None:
"""
:keyword system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:paramtype system_data:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData
:keyword repository_url: Url of the SourceControl Repository.
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/__init__.py
index 4a64188d9a661..87a0bf0894aec 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/__init__.py
@@ -5,13 +5,19 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
-from ._extensions_operations import ExtensionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._extensions_operations import ExtensionsOperations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -19,5 +25,5 @@
"Operations",
"ExtensionsOperations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py
index bc1e22f5d2909..8dee270c5c0c4 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
+import sys
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
@@ -20,16 +20,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -297,7 +299,6 @@ def create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -311,7 +312,7 @@ def create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: IO,
+ extension_instance: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -334,11 +335,10 @@ def create(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties necessary to Create an Extension Instance. Required.
- :type extension_instance: IO
+ :type extension_instance: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -352,7 +352,7 @@ def create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: Union[_models.ExtensionInstance, IO],
+ extension_instance: Union[_models.ExtensionInstance, IO[bytes]],
**kwargs: Any
) -> _models.ExtensionInstance:
"""Create a new Kubernetes Cluster Extension Instance.
@@ -373,18 +373,14 @@ def create(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties necessary to Create an Extension Instance. Is either a
- ExtensionInstance type or a IO type. Required.
+ ExtensionInstance type or a IO[bytes] type. Required.
:type extension_instance:
- ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance or IO[bytes]
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -409,7 +405,7 @@ def create(
else:
_json = self._serialize.body(extension_instance, "ExtensionInstance")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -420,16 +416,14 @@ def create(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -439,16 +433,12 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionInstance", pipeline_response)
+ deserialized = self._deserialize("ExtensionInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -477,12 +467,11 @@ def get(
:type cluster_name: str
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -498,7 +487,7 @@ def get(
)
cls: ClsType[_models.ExtensionInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -506,16 +495,14 @@ def get(
extension_instance_name=extension_instance_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -525,16 +512,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionInstance", pipeline_response)
+ deserialized = self._deserialize("ExtensionInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return deserialized # type: ignore
@overload
def update(
@@ -572,7 +555,6 @@ def update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -586,7 +568,7 @@ def update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: IO,
+ extension_instance: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -609,11 +591,10 @@ def update(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties to Update in the Extension Instance. Required.
- :type extension_instance: IO
+ :type extension_instance: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -627,7 +608,7 @@ def update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_instance_name: str,
- extension_instance: Union[_models.ExtensionInstanceUpdate, IO],
+ extension_instance: Union[_models.ExtensionInstanceUpdate, IO[bytes]],
**kwargs: Any
) -> _models.ExtensionInstance:
"""Update an existing Kubernetes Cluster Extension Instance.
@@ -648,18 +629,15 @@ def update(
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_name: str
:param extension_instance: Properties to Update in the Extension Instance. Is either a
- ExtensionInstanceUpdate type or a IO type. Required.
+ ExtensionInstanceUpdate type or a IO[bytes] type. Required.
:type extension_instance:
- ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate or
+ IO[bytes]
:return: ExtensionInstance or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -684,7 +662,7 @@ def update(
else:
_json = self._serialize.body(extension_instance, "ExtensionInstanceUpdate")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -695,16 +673,14 @@ def update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -714,16 +690,12 @@ def update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionInstance", pipeline_response)
+ deserialized = self._deserialize("ExtensionInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
@@ -753,12 +725,11 @@ def delete( # pylint: disable=inconsistent-return-statements
:type cluster_name: str
:param extension_instance_name: Name of an instance of the Extension. Required.
:type extension_instance_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 = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -774,7 +745,7 @@ def delete( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -782,16 +753,14 @@ def delete( # pylint: disable=inconsistent-return-statements
extension_instance_name=extension_instance_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -802,11 +771,7 @@ def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list(
@@ -832,7 +797,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionInstance or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance]
@@ -846,7 +810,7 @@ def list(
)
cls: ClsType[_models.ExtensionInstancesList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -857,19 +821,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -880,14 +842,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionInstancesList", pipeline_response)
@@ -897,11 +858,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -913,7 +874,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_operations.py
index 0f61ef63f6bfe..9c787c677feb2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -77,9 +79,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,14 +107,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -123,14 +123,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -140,11 +139,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -156,5 +155,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py
index 8f5b03716b5c5..f786a8f198f12 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -253,13 +257,12 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -275,7 +278,7 @@ def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -283,16 +286,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -302,16 +303,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -350,7 +347,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
@@ -365,7 +361,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -389,11 +385,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
@@ -408,7 +403,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -429,19 +424,16 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -466,7 +458,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -477,16 +469,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -496,22 +486,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -519,8 +501,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -534,9 +516,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -544,31 +526,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -598,14 +583,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -621,7 +598,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -633,11 +610,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -646,17 +624,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -667,6 +641,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. Required.
@@ -682,7 +657,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -697,7 +671,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -708,19 +682,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -731,14 +703,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -748,11 +719,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -764,7 +735,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_configuration.py
index 89400cae6ee48..5c2597b328abe 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -36,7 +34,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-10-01-preview")
if credential is None:
@@ -49,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -57,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json
index beacd0ece51e8..94b9716d2b316 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"source_control_configurations": "SourceControlConfigurationsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py
index 74ae007ce03b4..f78921f4f4b4f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import Operations, SourceControlConfigurationsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar source_control_configurations: SourceControlConfigurationsOperations operations
@@ -55,7 +57,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -68,7 +88,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2020-10-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -88,12 +108,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_configuration.py
index 24715414593cc..9c49577c529db 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -36,7 +34,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-10-01-preview")
if credential is None:
@@ -49,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -57,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py
index d21e3275944d7..1b504dc4c9dba 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import Operations, SourceControlConfigurationsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar source_control_configurations: SourceControlConfigurationsOperations operations
@@ -55,7 +57,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -68,7 +88,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2020-10-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -88,12 +110,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/__init__.py
index 7a7def29a23aa..2e8e303f96743 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/__init__.py
@@ -5,17 +5,23 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_operations.py
index 7db6fbb45bf85..8b301d0b4bae5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -72,7 +74,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,14 +85,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -101,14 +101,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -118,11 +117,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,5 +133,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py
index fbf74bcb823c7..c2381ee492c50 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -89,13 +93,12 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -111,7 +114,7 @@ async def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -119,16 +122,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -138,16 +139,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -186,7 +183,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
@@ -201,7 +197,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -225,11 +221,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
@@ -244,7 +239,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -265,19 +260,16 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -302,7 +294,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -313,16 +305,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -332,22 +322,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -355,8 +337,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -370,9 +352,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2020-10-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -380,31 +362,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -434,14 +419,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -457,7 +434,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -469,11 +446,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -482,17 +460,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -503,6 +477,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. Required.
@@ -518,7 +493,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -533,7 +507,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -544,19 +518,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -567,14 +539,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -584,11 +555,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -600,7 +571,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/__init__.py
index 5091422d70d92..587d2be80d26b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/__init__.py
@@ -5,30 +5,41 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ErrorDefinition
-from ._models_py3 import ErrorResponse
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import ProxyResource
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Result
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import Enum0
-from ._source_control_configuration_client_enums import Enum1
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningStateType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ComplianceStatus,
+ ErrorDefinition,
+ ErrorResponse,
+ HelmOperatorProperties,
+ ProxyResource,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Result,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ ComplianceStateType,
+ Enum0,
+ Enum1,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningStateType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -53,5 +64,5 @@
"OperatorType",
"ProvisioningStateType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py
index b2b0383ac6e56..d37f08fa0bf0c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py
@@ -1,5 +1,4 @@
# 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.
@@ -13,7 +12,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -75,7 +73,7 @@ def __init__(
class ErrorDefinition(_serialization.Model):
"""Error definition.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar code: Service specific error code which serves as the substatus for the HTTP error code.
Required.
@@ -170,7 +168,7 @@ class Resource(_serialization.Model):
:ivar type: Resource type.
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData
"""
@@ -190,7 +188,7 @@ class Resource(_serialization.Model):
def __init__(self, *, system_data: Optional["_models.SystemData"] = None, **kwargs: Any) -> None:
"""
:keyword system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:paramtype system_data:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData
"""
@@ -213,32 +211,10 @@ class ProxyResource(Resource):
:ivar type: Resource type.
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData
"""
- _validation = {
- "id": {"readonly": True},
- "name": {"readonly": True},
- "type": {"readonly": True},
- }
-
- _attribute_map = {
- "id": {"key": "id", "type": "str"},
- "name": {"key": "name", "type": "str"},
- "type": {"key": "type", "type": "str"},
- "system_data": {"key": "systemData", "type": "SystemData"},
- }
-
- def __init__(self, *, system_data: Optional["_models.SystemData"] = None, **kwargs: Any) -> None:
- """
- :keyword system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
- :paramtype system_data:
- ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData
- """
- super().__init__(system_data=system_data, **kwargs)
-
class ResourceProviderOperation(_serialization.Model):
"""Supported operation of this resource provider.
@@ -382,7 +358,7 @@ def __init__(self, *, sample_property: Optional[str] = None, **kwargs: Any) -> N
self.sample_property = sample_property
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -394,7 +370,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
:ivar type: Resource type.
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
@@ -483,7 +459,7 @@ def __init__(
) -> None:
"""
:keyword system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:paramtype system_data:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData
:keyword repository_url: Url of the SourceControl Repository.
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/__init__.py
index 7a7def29a23aa..2e8e303f96743 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/__init__.py
@@ -5,17 +5,23 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_operations.py
index 90719da140b64..25a914db35d2d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -77,9 +79,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,14 +107,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -123,14 +123,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -140,11 +139,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -156,5 +155,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py
index d3ec4569dc808..c157918e1c8fa 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -253,13 +257,12 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -275,7 +278,7 @@ def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -283,16 +286,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -302,16 +303,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -350,7 +347,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
@@ -365,7 +361,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -389,11 +385,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
@@ -408,7 +403,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -429,19 +424,16 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -466,7 +458,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -477,16 +469,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -496,22 +486,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -519,8 +501,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -534,9 +516,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2020-10-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -544,31 +526,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -598,14 +583,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -621,7 +598,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -633,11 +610,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -646,17 +624,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -667,6 +641,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. Required.
@@ -682,7 +657,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -697,7 +671,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -708,19 +682,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -731,14 +703,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -748,11 +719,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -764,7 +735,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_configuration.py
index 82f4aa4602b88..8934e8145910b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -36,7 +34,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-03-01")
if credential is None:
@@ -49,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -57,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json
index b872e0f0c0881..f08b6dba8d42e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"source_control_configurations": "SourceControlConfigurationsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py
index 7d8477b87fb9a..d6ed07e19339e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import Operations, SourceControlConfigurationsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar source_control_configurations: SourceControlConfigurationsOperations operations
@@ -54,7 +56,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -65,7 +85,7 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -85,12 +105,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_configuration.py
index c2fb4c125997c..f30cd7083e3cb 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -36,7 +34,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-03-01")
if credential is None:
@@ -49,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -57,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py
index 66eb0328d1485..5a08038465547 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import Operations, SourceControlConfigurationsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar source_control_configurations: SourceControlConfigurationsOperations operations
@@ -54,7 +56,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -65,7 +85,9 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-03-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -85,12 +107,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/__init__.py
index 7a7def29a23aa..2e8e303f96743 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/__init__.py
@@ -5,17 +5,23 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_operations.py
index 6e82a57073941..43589c78f99d2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -70,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -99,14 +99,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -116,11 +115,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -132,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_operations.py
index 7859f5c1a4ef2..d500fc5d032a9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -89,12 +93,11 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -108,7 +111,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -116,16 +119,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -135,16 +136,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -183,7 +180,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -197,7 +193,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -221,11 +217,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -239,7 +234,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -260,18 +255,14 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -294,7 +285,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -305,16 +296,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -324,22 +313,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -347,8 +328,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -360,9 +341,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -370,31 +351,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -424,14 +408,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -445,7 +421,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -457,11 +433,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -470,17 +447,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -491,6 +464,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. Required.
@@ -506,7 +480,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -519,7 +492,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -530,19 +503,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -553,14 +524,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -570,11 +540,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -586,7 +556,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py
index 2deeb4209fbe0..8215180aba628 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py
@@ -5,31 +5,42 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ErrorDefinition
-from ._models_py3 import ErrorResponse
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import ProxyResource
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Result
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import Enum0
-from ._source_control_configuration_client_enums import Enum1
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningStateType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ComplianceStatus,
+ ErrorDefinition,
+ ErrorResponse,
+ HelmOperatorProperties,
+ ProxyResource,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Result,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ ComplianceStateType,
+ CreatedByType,
+ Enum0,
+ Enum1,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningStateType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -55,5 +66,5 @@
"OperatorType",
"ProvisioningStateType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py
index bf368286b011d..d044924043a1e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py
@@ -1,5 +1,4 @@
# 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.
@@ -13,7 +12,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -75,7 +73,7 @@ def __init__(
class ErrorDefinition(_serialization.Model):
"""Error definition.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar code: Service specific error code which serves as the substatus for the HTTP error code.
Required.
@@ -164,7 +162,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -200,7 +198,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -209,22 +207,6 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
class ResourceProviderOperation(_serialization.Model):
"""Supported operation of this resource provider.
@@ -368,13 +350,13 @@ def __init__(self, *, sample_property: Optional[str] = None, **kwargs: Any) -> N
self.sample_property = sample_property
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -382,7 +364,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/__init__.py
index 7a7def29a23aa..2e8e303f96743 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/__init__.py
@@ -5,17 +5,23 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py
index 2a6567f5ff315..ed02555e5ac08 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -92,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,14 +104,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -121,14 +120,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -138,11 +136,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -154,5 +152,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py
index 2b2488dcd86d8..f932749c3311d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -253,12 +257,11 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -272,7 +275,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -280,16 +283,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -299,16 +300,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -347,7 +344,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -361,7 +357,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -385,11 +381,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -403,7 +398,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -424,18 +419,14 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +449,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -469,16 +460,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -488,22 +477,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -511,8 +492,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -524,9 +505,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -534,31 +515,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -588,14 +572,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -609,7 +585,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -621,11 +597,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -634,17 +611,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -670,7 +643,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -683,7 +655,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-03-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -694,19 +666,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -717,14 +687,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -734,11 +703,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -750,7 +719,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_configuration.py
index b06ff76f66c4e..b76452fca303c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-05-01-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json
index ac1bce9b6982c..1d290d9e8aa58 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py
index c0e24b7f05b42..dbd17093d3afc 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -27,11 +30,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class SourceControlConfigurationClient: # pylint: disable=too-many-instance-attributes
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -81,7 +83,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -112,7 +132,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-05-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -132,12 +152,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_configuration.py
index ace9867638f41..e9ca8a1f0d016 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-05-01-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py
index 3f5b8bc046b4d..cd21f1d255d36 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -27,11 +30,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class SourceControlConfigurationClient: # pylint: disable=too-many-instance-attributes
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -81,7 +83,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -112,7 +132,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-05-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -132,12 +154,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/__init__.py
index dd2b466df3431..adc94140aec05 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/__init__.py
@@ -5,18 +5,24 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -29,5 +35,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py
index 7f20c5589a9ef..8b444fb9fca9f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._cluster_extension_type_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -78,12 +80,11 @@ async def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -99,7 +100,7 @@ async def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_type=cluster_type,
@@ -107,16 +108,14 @@ async def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -126,13 +125,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py
index 020a79e48502c..e46ccc8c0b956 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._cluster_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -57,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, resource_group_name: str, cluster_rp: Union[str, _models.Enum0], cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""Get Extension Types.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -68,7 +71,6 @@ def list(
:type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType]
@@ -82,7 +84,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -93,18 +95,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -115,14 +115,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -132,11 +131,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -148,7 +147,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py
index c6eaf3a4aec17..2ca37d3e45f38 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._extension_type_versions_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> AsyncIterable["_models.ExtensionVersionListVersionsItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListVersionsItem or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,17 +91,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -110,14 +110,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -127,11 +126,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -143,7 +142,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_operations.py
index f1f30f8c59437..d11a45d54d745 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -69,10 +73,10 @@ async def _create_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -87,7 +91,7 @@ async def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -97,7 +101,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -108,40 +112,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -178,14 +177,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -201,7 +192,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -225,18 +216,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -252,7 +235,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -274,19 +257,9 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension or
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -319,12 +292,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -337,17 +311,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -377,12 +349,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -398,7 +369,7 @@ async def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -406,16 +377,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -425,18 +394,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -445,8 +410,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -460,9 +425,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -471,31 +436,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -530,14 +498,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -553,7 +513,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -566,11 +526,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -582,17 +543,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -603,6 +560,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.Extension"]:
+ # pylint: disable=line-too-long
"""List all Extensions in the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -619,7 +577,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension]
@@ -633,7 +590,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -644,19 +601,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -667,14 +622,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -684,11 +638,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -700,7 +654,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py
index 2efe43e6c1548..913f3c9da5d73 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._location_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,11 +57,11 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""List all Extension Types.
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType]
@@ -73,7 +75,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,16 +86,14 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -104,14 +104,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -121,11 +120,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -137,7 +136,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_operations.py
index d4931220d7175..c75ddc2918871 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -63,6 +65,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -79,7 +82,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -94,7 +96,7 @@ def list(
)
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,19 +107,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -128,14 +128,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -145,11 +144,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -162,10 +161,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
-
@distributed_trace_async
async def get(
self,
@@ -197,12 +192,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -218,7 +212,7 @@ async def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -227,16 +221,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -246,13 +238,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operations.py
index 33386aba76801..e69ebebbdf3c7 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -72,7 +74,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,14 +85,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -101,14 +101,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -118,11 +117,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,5 +133,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py
index c3f443169419b..9843c4eaa5e36 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -90,13 +94,12 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -112,7 +115,7 @@ async def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -120,16 +123,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -139,16 +140,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -188,7 +185,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
@@ -203,7 +199,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -228,11 +224,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
@@ -247,7 +242,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -269,19 +264,16 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -306,7 +298,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -317,16 +309,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -336,22 +326,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -359,8 +341,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -374,9 +356,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -384,31 +366,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -439,14 +424,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -462,7 +439,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -474,11 +451,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -487,17 +465,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -508,6 +482,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -524,7 +499,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -539,7 +513,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -550,19 +524,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -573,14 +545,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -590,11 +561,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -606,7 +577,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py
index e01298b5ecbdd..b04917a32cd1a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py
@@ -5,50 +5,61 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ClusterScopeSettings
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionType
-from ._models_py3 import ExtensionTypeList
-from ._models_py3 import ExtensionVersionList
-from ._models_py3 import ExtensionVersionListVersionsItem
-from ._models_py3 import ExtensionsList
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import Identity
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import ProxyResource
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SupportedScopes
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import ClusterTypes
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import Enum0
-from ._source_control_configuration_client_enums import Enum1
-from ._source_control_configuration_client_enums import Enum5
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import ProvisioningStateType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ClusterScopeSettings,
+ ComplianceStatus,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionStatus,
+ ExtensionType,
+ ExtensionTypeList,
+ ExtensionVersionList,
+ ExtensionVersionListVersionsItem,
+ ExtensionsList,
+ HelmOperatorProperties,
+ Identity,
+ OperationStatusList,
+ OperationStatusResult,
+ ProxyResource,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SupportedScopes,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ ClusterTypes,
+ ComplianceStateType,
+ CreatedByType,
+ Enum0,
+ Enum1,
+ Enum5,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningState,
+ ProvisioningStateType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -93,5 +104,5 @@
"ProvisioningState",
"ProvisioningStateType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py
index c3862d1116b04..91183e4fae4fa 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -29,7 +22,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -65,7 +58,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -74,22 +67,6 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
class ClusterScopeSettings(ProxyResource):
"""Extension scope settings.
@@ -97,7 +74,7 @@ class ClusterScopeSettings(ProxyResource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -292,13 +269,13 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -308,7 +285,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData
:ivar extension_type: Type of the Extension, of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the
@@ -759,7 +736,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -1022,13 +999,13 @@ def __init__(self, *, target_namespace: Optional[str] = None, **kwargs: Any) ->
self.target_namespace = target_namespace
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -1036,7 +1013,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/__init__.py
index dd2b466df3431..adc94140aec05 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/__init__.py
@@ -5,18 +5,24 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -29,5 +35,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py
index dc0e630cbdf5d..79c196e1f967d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -123,12 +125,11 @@ def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -144,7 +145,7 @@ def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_type=cluster_type,
@@ -152,16 +153,14 @@ def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -171,13 +170,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py
index c9c266c441008..b4b8b32e590cd 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -109,7 +111,6 @@ def list(
:type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType]
@@ -123,7 +124,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -134,18 +135,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -156,14 +155,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -173,11 +171,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -189,7 +187,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py
index abd14e49c50c1..c48aefddc7eee 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -89,13 +91,13 @@ def __init__(self, *args, **kwargs):
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> Iterable["_models.ExtensionVersionListVersionsItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListVersionsItem or the result of
cls(response)
:rtype:
@@ -110,7 +112,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,17 +123,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -142,14 +142,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -159,11 +158,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -175,7 +174,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py
index 97a8123980e88..ca9738bf6d5ea 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -239,10 +243,10 @@ def _create_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -257,7 +261,7 @@ def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -267,7 +271,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -278,40 +282,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -348,14 +347,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension]
@@ -370,7 +361,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -394,18 +385,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension]
@@ -420,7 +403,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -442,19 +425,9 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension or
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension]
@@ -486,12 +459,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -503,17 +477,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -543,12 +515,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -564,7 +535,7 @@ def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -572,16 +543,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -591,18 +560,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -611,8 +576,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -626,9 +591,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -637,31 +602,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -696,14 +664,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -719,7 +679,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -732,11 +692,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -747,17 +708,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -784,7 +741,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension]
@@ -798,7 +754,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -809,19 +765,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -832,14 +786,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -849,11 +802,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -865,7 +818,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py
index 38a1072f91353..5e318b1228477 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -90,7 +92,6 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType]
@@ -104,7 +105,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -115,16 +116,14 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -135,14 +134,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -152,11 +150,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -168,7 +166,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py
index 56d6f9cf0e55a..7ecfe58cc2832 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -149,6 +151,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -165,7 +168,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -180,7 +182,7 @@ def list(
)
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,19 +193,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -214,14 +214,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -231,11 +230,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -248,10 +247,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
-
@distributed_trace
def get(
self,
@@ -283,12 +278,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -304,7 +298,7 @@ def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -313,16 +307,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -332,13 +324,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operations.py
index 512b8d579f596..6a9730fa7d7e2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -77,9 +79,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,14 +107,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -123,14 +123,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -140,11 +139,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -156,5 +155,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py
index c01d178e20262..9d4523f991c63 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -262,13 +266,12 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -284,7 +287,7 @@ def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -292,16 +295,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -311,16 +312,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -360,7 +357,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
@@ -375,7 +371,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -400,11 +396,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
@@ -419,7 +414,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -441,19 +436,16 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -478,7 +470,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -489,16 +481,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -508,22 +498,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -531,8 +513,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -546,9 +528,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -556,31 +538,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -611,14 +596,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -634,7 +611,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -646,11 +623,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -659,17 +637,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -680,6 +654,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -696,7 +671,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -711,7 +685,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -722,19 +696,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -745,14 +717,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -762,11 +733,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -778,7 +749,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_configuration.py
index 72bdaa8e883a5..637a855d1ae56 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-09-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json
index 663ebfb0f1ba8..4b2291ac84afd 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py
index 422ad582538be..ab8f44fb57606 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import ExtensionsOperations, OperationStatusOperations, Operations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -56,7 +58,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -70,7 +90,7 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-09-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -90,12 +110,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_configuration.py
index dba256f4dbd75..a789f872f0417 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-09-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py
index 21cddee86ec67..818bc8f4a293d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -18,11 +21,10 @@
from .operations import ExtensionsOperations, OperationStatusOperations, Operations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -56,7 +58,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -70,7 +90,9 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2021-09-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -90,12 +112,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/__init__.py
index bd1d079823a2a..431a14404630a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/__init__.py
@@ -5,13 +5,19 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -19,5 +25,5 @@
"OperationStatusOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_operations.py
index d0a52e2f75d14..0c192348f9da4 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,7 +90,7 @@ async def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -96,7 +100,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,40 +111,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -177,14 +176,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -200,7 +191,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -224,18 +215,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -251,7 +234,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -273,19 +256,8 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -316,12 +288,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -334,17 +307,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -374,12 +345,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -393,7 +363,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -401,16 +371,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -420,18 +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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -440,8 +404,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -453,9 +417,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -464,31 +428,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -523,14 +490,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -544,7 +503,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -557,11 +516,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -573,17 +533,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -592,15 +548,20 @@ async def _update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -610,7 +571,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -620,7 +581,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -631,35 +592,34 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@overload
async def begin_update(
@@ -697,14 +657,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -720,7 +672,7 @@ async def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -744,18 +696,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -771,7 +715,7 @@ async def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -793,20 +737,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -837,12 +770,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -855,17 +789,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -892,7 +824,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -904,7 +835,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -915,19 +846,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -938,14 +867,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -955,11 +883,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -971,7 +899,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_operations.py
index 2b2c43236192e..a64c397103e7e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -63,6 +65,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -79,7 +82,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -92,7 +94,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,19 +105,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -126,14 +126,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -143,11 +142,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -160,10 +159,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
-
@distributed_trace_async
async def get(
self,
@@ -195,12 +190,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,7 +208,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -223,16 +217,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -242,13 +234,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operations.py
index 00baf56d5ce73..d185a1885d508 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,10 +57,10 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports, in
this api-version.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -71,7 +73,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -82,14 +84,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -100,14 +100,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -117,11 +116,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -133,5 +132,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py
index d690179db2336..059ae73a318a6 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py
@@ -5,35 +5,46 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionsList
-from ._models_py3 import Identity
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import ProxyResource
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import Enum0
-from ._source_control_configuration_client_enums import Enum1
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import ProvisioningState
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionsList,
+ Identity,
+ OperationStatusList,
+ OperationStatusResult,
+ PatchExtension,
+ ProxyResource,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ CreatedByType,
+ Enum0,
+ Enum1,
+ LevelType,
+ ProvisioningState,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -63,5 +74,5 @@
"LevelType",
"ProvisioningState",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py
index dd3120217b983..d736341fea2f4 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py
@@ -1,5 +1,4 @@
# 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,18 +7,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -122,7 +114,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -158,7 +150,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -167,30 +159,14 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -200,7 +176,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.SystemData
:ivar extension_type: Type of the Extension, of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the
@@ -525,7 +501,7 @@ def __init__(self, **kwargs: Any) -> None:
class OperationStatusResult(_serialization.Model):
"""The current status of an async operation.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/__init__.py
index bd1d079823a2a..431a14404630a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/__init__.py
@@ -5,13 +5,19 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -19,5 +25,5 @@
"OperationStatusOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py
index d3a3dc4962b51..2345e80e85992 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +305,7 @@ def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -310,7 +315,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -321,40 +326,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -391,14 +391,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -413,7 +405,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -437,18 +429,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -463,7 +447,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -485,19 +469,8 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -527,12 +500,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -544,17 +518,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -584,12 +556,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -603,7 +574,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -611,16 +582,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -630,18 +599,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -650,8 +615,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -663,9 +628,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -674,31 +639,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -733,14 +701,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -754,7 +714,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -767,11 +727,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -782,17 +743,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -801,15 +758,20 @@ def _update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -819,7 +781,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -829,7 +791,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -840,35 +802,34 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@overload
def begin_update(
@@ -906,14 +867,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -928,7 +881,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -952,18 +905,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -978,7 +923,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -1000,20 +945,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -1043,12 +977,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1060,17 +995,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1097,7 +1030,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension]
@@ -1109,7 +1041,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1120,19 +1052,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1143,14 +1073,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1160,11 +1089,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1176,7 +1105,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py
index 2ab7570ae6fce..cc1bb322d8dd1 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -165,7 +167,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -178,7 +179,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -189,19 +190,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -212,14 +211,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -229,11 +227,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -246,10 +244,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
-
@distributed_trace
def get(
self,
@@ -281,12 +275,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +293,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -309,16 +302,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -328,13 +319,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operations.py
index 3fcf27e44d0b0..ddac47f231917 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +82,6 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
"""List all the available operations the KubernetesConfiguration resource provider supports, in
this api-version.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -93,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,14 +105,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -122,14 +121,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -139,11 +137,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -155,5 +153,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_configuration.py
index c88b483e2ce4c..8b7bf22f78577 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-11-01-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json
index 5f058333c37e2..e3f5d94260efa 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py
index 61d92a1f07604..863ec4a040f4a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -29,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class SourceControlConfigurationClient: # pylint: disable=too-many-instance-attributes
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -89,7 +91,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -126,7 +146,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-11-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -146,12 +166,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_configuration.py
index b5ee9c6a84006..3b7ed2fd8f2f0 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-11-01-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py
index 20bce7c288ebd..f36022fb90bbd 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -29,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class SourceControlConfigurationClient: # pylint: disable=too-many-instance-attributes
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -89,7 +91,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -126,7 +146,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-11-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -146,12 +168,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/__init__.py
index 3f15324c47082..27e79b062bcc9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/__init__.py
@@ -5,20 +5,26 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -33,5 +39,5 @@
"FluxConfigOperationStatusOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py
index bb6b10ce59f26..b11e9e4b85bee 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._cluster_extension_type_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,12 +81,11 @@ async def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,7 +101,7 @@ async def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -108,16 +109,14 @@ async def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -127,13 +126,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py
index 33c106958fc4f..4ce9fec8b2f22 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._cluster_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -62,6 +64,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""Get Extension Types.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -78,7 +81,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType]
@@ -92,7 +94,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,19 +105,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -126,14 +126,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -143,11 +142,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -159,7 +158,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py
index 4de55b4d27419..d0cb848f1710e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._extension_type_versions_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> AsyncIterable["_models.ExtensionVersionListVersionsItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListVersionsItem or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,17 +91,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -110,14 +110,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -127,11 +126,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -143,7 +142,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_operations.py
index 3097deb7f51b8..4912c2cce05a4 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,7 +92,7 @@ async def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -98,7 +102,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -109,40 +113,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -179,14 +178,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -202,7 +193,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -226,18 +217,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -253,7 +236,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -275,19 +258,9 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension or
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -320,12 +293,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -338,17 +312,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -378,12 +350,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -399,7 +370,7 @@ async def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -407,16 +378,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -426,18 +395,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -446,8 +411,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,9 +426,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -472,31 +437,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -531,14 +499,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -554,7 +514,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -567,11 +527,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -583,17 +544,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -602,15 +559,20 @@ async def _update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -622,7 +584,7 @@ async def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -632,7 +594,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -643,35 +605,34 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@overload
async def begin_update(
@@ -710,14 +671,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -733,7 +686,7 @@ async def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -757,18 +710,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -784,7 +729,7 @@ async def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -806,20 +751,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -852,12 +786,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -870,17 +805,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -891,6 +824,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.Extension"]:
+ # pylint: disable=line-too-long
"""List all Extensions in the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -907,7 +841,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -921,7 +854,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -932,19 +865,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -955,14 +886,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -972,11 +902,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -988,7 +918,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py
index 27c31b4b2798d..c93b34d473da6 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_config_operation_status_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -82,12 +84,11 @@ async def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +104,7 @@ async def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -112,16 +113,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -131,13 +130,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py
index c277cf4c962ff..94946e23eeed3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -91,12 +95,11 @@ async def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -112,7 +115,7 @@ async def get(
)
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -120,16 +123,14 @@ async def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -139,16 +140,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
@@ -157,15 +154,20 @@ async def _create_or_update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -177,7 +179,7 @@ async def _create_or_update_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -187,7 +189,7 @@ async def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -198,40 +200,35 @@ async def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
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("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -245,6 +242,7 @@ async def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Create a new Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -269,14 +267,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -292,11 +282,12 @@ async def begin_create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Create a new Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -316,18 +307,10 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -343,9 +326,10 @@ async def begin_create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Create a new Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -365,20 +349,9 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -411,12 +384,13 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -429,17 +403,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
async def _update_initial(
self,
@@ -448,15 +420,20 @@ async def _update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -468,7 +445,7 @@ async def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -478,7 +455,7 @@ async def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -489,35 +466,34 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def begin_update(
@@ -532,6 +508,7 @@ async def begin_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Update an existing Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -557,14 +534,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -580,11 +549,12 @@ async def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Update an existing Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -605,18 +575,10 @@ async def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -632,9 +594,10 @@ async def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Update an existing Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -654,20 +617,10 @@ async def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch or
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -700,12 +653,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -718,19 +672,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -739,8 +691,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -754,9 +706,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -765,31 +717,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -824,14 +779,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -847,7 +794,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -860,11 +807,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -876,17 +824,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -897,6 +841,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.FluxConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Flux Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -913,7 +858,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration]
@@ -927,7 +871,7 @@ def list(
)
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -938,19 +882,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -961,14 +903,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -978,11 +919,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -994,7 +935,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py
index a7cec8eb714c7..44797f6fca030 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._location_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,11 +57,11 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""List all Extension Types.
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType]
@@ -73,7 +75,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,16 +86,14 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -104,14 +104,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -121,11 +120,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -137,7 +136,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_operations.py
index 4ae39c063ce1f..c6d18428b7f48 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -85,12 +87,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +107,7 @@ async def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -115,16 +116,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,16 +133,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -154,6 +149,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -170,7 +166,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -185,7 +180,7 @@ def list(
)
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -196,19 +191,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -219,14 +212,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -236,11 +228,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -252,7 +244,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operations.py
index 1b96a0e2efe73..f41b658f20ffb 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -72,7 +74,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,14 +85,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -101,14 +101,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -118,11 +117,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,5 +133,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py
index ab0ee89a9b99b..52b60daa6e71c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -90,13 +94,12 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -112,7 +115,7 @@ async def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -120,16 +123,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -139,16 +140,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -188,7 +185,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
@@ -203,7 +199,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -228,11 +224,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
@@ -247,7 +242,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -269,19 +264,16 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -306,7 +298,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -317,16 +309,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -336,22 +326,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -359,8 +341,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -374,9 +356,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -384,31 +366,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -439,14 +424,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -462,7 +439,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -474,11 +451,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -487,17 +465,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -508,6 +482,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -524,7 +499,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -539,7 +513,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -550,19 +524,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -573,14 +545,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -590,11 +561,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -606,7 +577,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py
index e4780f6d44151..6db1950aa423c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py
@@ -5,66 +5,77 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ClusterScopeSettings
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import DependsOnDefinition
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionType
-from ._models_py3 import ExtensionTypeList
-from ._models_py3 import ExtensionVersionList
-from ._models_py3 import ExtensionVersionListVersionsItem
-from ._models_py3 import ExtensionsList
-from ._models_py3 import FluxConfiguration
-from ._models_py3 import FluxConfigurationPatch
-from ._models_py3 import FluxConfigurationsList
-from ._models_py3 import GitRepositoryDefinition
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import HelmReleasePropertiesDefinition
-from ._models_py3 import Identity
-from ._models_py3 import KustomizationDefinition
-from ._models_py3 import ObjectReferenceDefinition
-from ._models_py3 import ObjectStatusConditionDefinition
-from ._models_py3 import ObjectStatusDefinition
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import ProxyResource
-from ._models_py3 import RepositoryRefDefinition
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SupportedScopes
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import ClusterTypes
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import Enum0
-from ._source_control_configuration_client_enums import Enum1
-from ._source_control_configuration_client_enums import FluxComplianceState
-from ._source_control_configuration_client_enums import KustomizationValidationType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import ProvisioningStateType
-from ._source_control_configuration_client_enums import ScopeType
-from ._source_control_configuration_client_enums import SourceKindType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ClusterScopeSettings,
+ ComplianceStatus,
+ DependsOnDefinition,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionType,
+ ExtensionTypeList,
+ ExtensionVersionList,
+ ExtensionVersionListVersionsItem,
+ ExtensionsList,
+ FluxConfiguration,
+ FluxConfigurationPatch,
+ FluxConfigurationsList,
+ GitRepositoryDefinition,
+ HelmOperatorProperties,
+ HelmReleasePropertiesDefinition,
+ Identity,
+ KustomizationDefinition,
+ ObjectReferenceDefinition,
+ ObjectStatusConditionDefinition,
+ ObjectStatusDefinition,
+ OperationStatusList,
+ OperationStatusResult,
+ PatchExtension,
+ ProxyResource,
+ RepositoryRefDefinition,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SupportedScopes,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ ClusterTypes,
+ ComplianceStateType,
+ CreatedByType,
+ Enum0,
+ Enum1,
+ FluxComplianceState,
+ KustomizationValidationType,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningState,
+ ProvisioningStateType,
+ ScopeType,
+ SourceKindType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -125,5 +136,5 @@
"ScopeType",
"SourceKindType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py
index 700bb775b91af..ad10c9181c8f2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -29,7 +22,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -65,7 +58,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -74,22 +67,6 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
class ClusterScopeSettings(ProxyResource):
"""Extension scope settings.
@@ -97,7 +74,7 @@ class ClusterScopeSettings(ProxyResource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -313,13 +290,13 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -329,7 +306,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData
:ivar extension_type: Type of the Extension, of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the
@@ -730,13 +707,13 @@ def __init__(
self.versions = versions
-class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class FluxConfiguration(ProxyResource):
"""The Flux Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -744,7 +721,7 @@ class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-att
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData
:ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and
"namespace".
@@ -1477,7 +1454,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -1849,13 +1826,13 @@ def __init__(self, *, target_namespace: Optional[str] = None, **kwargs: Any) ->
self.target_namespace = target_namespace
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -1863,7 +1840,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/__init__.py
index 3f15324c47082..27e79b062bcc9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/__init__.py
@@ -5,20 +5,26 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -33,5 +39,5 @@
"FluxConfigOperationStatusOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py
index d37802eb6fa5c..e70504b44c566 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -124,12 +126,11 @@ def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +146,7 @@ def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -153,16 +154,14 @@ def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -172,13 +171,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py
index 581215ac1eb8f..cc2e72c15d1d3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -121,7 +123,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType]
@@ -135,7 +136,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,19 +147,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -169,14 +168,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -186,11 +184,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -202,7 +200,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py
index 3bdf78992d385..b4589e8a47db1 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -89,13 +91,13 @@ def __init__(self, *args, **kwargs):
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> Iterable["_models.ExtensionVersionListVersionsItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListVersionsItem or the result of
cls(response)
:rtype:
@@ -110,7 +112,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,17 +123,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -142,14 +142,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -159,11 +158,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -175,7 +174,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py
index ab10e16540e33..c73726c15f175 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -302,7 +307,7 @@ def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -312,7 +317,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -323,40 +328,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -393,14 +393,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -415,7 +407,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -439,18 +431,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -465,7 +449,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -487,19 +471,9 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension or
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -531,12 +505,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -548,17 +523,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -588,12 +561,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -609,7 +581,7 @@ def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -617,16 +589,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -636,18 +606,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -656,8 +622,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -671,9 +637,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -682,31 +648,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -741,14 +710,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -764,7 +725,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -777,11 +738,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -792,17 +754,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -811,15 +769,20 @@ def _update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -831,7 +794,7 @@ def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -841,7 +804,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -852,35 +815,34 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@overload
def begin_update(
@@ -919,14 +881,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -941,7 +895,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -965,18 +919,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -991,7 +937,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -1013,20 +959,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -1058,12 +993,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1075,17 +1011,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1112,7 +1046,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension]
@@ -1126,7 +1059,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1137,19 +1070,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1160,14 +1091,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1177,11 +1107,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1193,7 +1123,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py
index 2d07470053263..5020465624eaa 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -129,12 +131,11 @@ def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -150,7 +151,7 @@ def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -159,16 +160,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -178,13 +177,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py
index 97f2b58e0e115..76909fbce29df 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -305,12 +310,11 @@ def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -326,7 +330,7 @@ def get(
)
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -334,16 +338,14 @@ def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -353,16 +355,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
@@ -371,15 +369,20 @@ def _create_or_update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -391,7 +394,7 @@ def _create_or_update_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -401,7 +404,7 @@ def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -412,40 +415,35 @@ def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
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("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -483,14 +481,6 @@ def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -506,7 +496,7 @@ def begin_create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -530,18 +520,10 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -557,7 +539,7 @@ def begin_create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -579,20 +561,9 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -625,12 +596,13 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -642,17 +614,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
def _update_initial(
self,
@@ -661,15 +631,20 @@ def _update_initial(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
304: ResourceNotModifiedError,
- 409: lambda response: ResourceExistsError(
- response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat
+ 409: cast(
+ Type[HttpResponseError],
+ lambda response: ResourceExistsError(
+ response=response,
+ model=self._deserialize(_models.ErrorResponse, response),
+ error_format=ARMErrorFormat,
+ ),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})
@@ -681,7 +656,7 @@ def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -691,7 +666,7 @@ def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -702,35 +677,34 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
- map_error(status_code=response.status_code, response=response, error_map=error_map)
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def begin_update(
@@ -770,14 +744,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -793,7 +759,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -818,18 +784,10 @@ def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -845,7 +803,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -867,20 +825,10 @@ def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch or
+ IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -913,12 +861,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -930,19 +879,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -951,8 +898,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -966,9 +913,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -977,31 +924,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -1036,14 +986,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -1059,7 +1001,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -1072,11 +1014,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -1087,17 +1030,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -1124,7 +1063,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration]
@@ -1138,7 +1076,7 @@ def list(
)
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1149,19 +1087,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1172,14 +1108,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -1189,11 +1124,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1205,7 +1140,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py
index 222258b828bd4..e65eafb67aaf3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -90,7 +92,6 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType]
@@ -104,7 +105,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -115,16 +116,14 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -135,14 +134,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -152,11 +150,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -168,7 +166,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py
index 1b4ec6e4f0fcd..7900c0470e7fd 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -171,12 +173,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -192,7 +193,7 @@ def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -201,16 +202,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -220,16 +219,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -240,6 +235,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -256,7 +252,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -271,7 +266,7 @@ def list(
)
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -282,19 +277,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -305,14 +298,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -322,11 +314,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -338,7 +330,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operations.py
index 231b93d597e6b..81f661425a909 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -77,9 +79,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,14 +107,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -123,14 +123,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -140,11 +139,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -156,5 +155,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py
index 0d7da927f0989..275ec2451e927 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -262,13 +266,12 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -284,7 +287,7 @@ def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -292,16 +295,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -311,16 +312,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -360,7 +357,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
@@ -375,7 +371,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -400,11 +396,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
@@ -419,7 +414,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.Enum1],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -441,19 +436,16 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -478,7 +470,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -489,16 +481,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -508,22 +498,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.Enum0],
@@ -531,8 +513,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -546,9 +528,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2021-11-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -556,31 +538,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -611,14 +596,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -634,7 +611,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -646,11 +623,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -659,17 +637,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -680,6 +654,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -696,7 +671,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -711,7 +685,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -722,19 +696,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -745,14 +717,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -762,11 +733,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -778,7 +749,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_configuration.py
index 45240fd43f293..46560fcc2f2ec 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-01-01-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json
index 1c9617ffe4319..f21014eada447 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"cluster_extension_type": "ClusterExtensionTypeOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py
index 956d28c79df66..8e944d1c6269e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -29,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class SourceControlConfigurationClient: # pylint: disable=too-many-instance-attributes
"""KubernetesConfiguration Client.
:ivar cluster_extension_type: ClusterExtensionTypeOperations operations
@@ -89,7 +91,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -126,7 +146,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -146,12 +166,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_configuration.py
index 5519c63ca3f9a..ec816011da462 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-01-01-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py
index 662f138569e79..b73cfe825ca70 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -29,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class SourceControlConfigurationClient: # pylint: disable=too-many-instance-attributes
"""KubernetesConfiguration Client.
:ivar cluster_extension_type: ClusterExtensionTypeOperations operations
@@ -89,7 +91,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -126,7 +146,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -146,12 +168,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/__init__.py
index ccd968835618a..481b03e4d653f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/__init__.py
@@ -5,20 +5,26 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -33,5 +39,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py
index 7b60eb281d208..2d2e26b91d408 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._cluster_extension_type_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,12 +82,11 @@ async def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,7 +102,7 @@ async def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -109,16 +110,14 @@ async def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -128,13 +127,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py
index 6a5ee426f215b..967e42423f97e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._cluster_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -62,6 +64,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""Get Extension Types.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -79,7 +82,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType]
@@ -93,7 +95,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,19 +106,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -127,14 +127,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -144,11 +143,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -160,7 +159,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py
index 48459a2b9930a..d79d5310ec28c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._extension_type_versions_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> AsyncIterable["_models.ExtensionVersionListVersionsItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListVersionsItem or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,17 +91,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -110,14 +110,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -127,11 +126,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -143,7 +142,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_operations.py
index aeec073109e69..5b1cd0f10cf09 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,7 +92,7 @@ async def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -98,7 +102,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -109,40 +113,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -180,14 +179,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -203,7 +194,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -228,18 +219,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -255,7 +238,7 @@ async def begin_create(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -278,19 +261,9 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension or
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -323,12 +296,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -341,17 +315,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -382,12 +354,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -403,7 +374,7 @@ async def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -411,16 +382,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -430,18 +399,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.ExtensionsClusterRp],
@@ -450,8 +415,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -465,9 +430,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -476,31 +441,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -536,14 +504,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -559,7 +519,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -572,11 +532,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -588,17 +549,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -607,10 +564,10 @@ async def _update_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -625,7 +582,7 @@ async def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -635,7 +592,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -646,35 +603,34 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@overload
async def begin_update(
@@ -714,14 +670,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -737,7 +685,7 @@ async def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -762,18 +710,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -789,7 +729,7 @@ async def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -812,20 +752,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -858,12 +787,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -876,17 +806,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -897,6 +825,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.Extension"]:
+ # pylint: disable=line-too-long
"""List all Extensions in the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -914,7 +843,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -928,7 +856,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -939,19 +867,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -962,14 +888,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -979,11 +904,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -995,7 +920,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py
index 1e0c0c2a7f2ea..1ba9d3923995c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_config_operation_status_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -83,12 +85,11 @@ async def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,7 +105,7 @@ async def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -113,16 +114,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -132,13 +131,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py
index 568ca009dfbe2..1542af52354bf 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -92,12 +96,11 @@ async def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -113,7 +116,7 @@ async def get(
)
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -121,16 +124,14 @@ async def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -140,16 +141,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
@@ -158,10 +155,10 @@ async def _create_or_update_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -176,7 +173,7 @@ async def _create_or_update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -186,7 +183,7 @@ async def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -197,40 +194,35 @@ async def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -244,6 +236,7 @@ async def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Create a new Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -269,14 +262,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -292,11 +277,12 @@ async def begin_create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Create a new Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -317,18 +303,10 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -344,9 +322,10 @@ async def begin_create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Create a new Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -367,20 +346,9 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -413,12 +381,13 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -431,17 +400,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
async def _update_initial(
self,
@@ -450,10 +417,10 @@ async def _update_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -468,7 +435,7 @@ async def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -478,7 +445,7 @@ async def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -489,35 +456,34 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def begin_update(
@@ -532,6 +498,7 @@ async def begin_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Update an existing Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -558,14 +525,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -581,11 +540,12 @@ async def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Update an existing Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -607,18 +567,10 @@ async def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -634,9 +586,10 @@ async def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
"""Update an existing Kubernetes Flux Configuration.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -657,20 +610,10 @@ async def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch or
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -703,12 +646,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -721,19 +665,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.ExtensionsClusterRp],
@@ -742,8 +684,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -757,9 +699,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -768,31 +710,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -828,14 +773,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -851,7 +788,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -864,11 +801,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -880,17 +818,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -901,6 +835,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.FluxConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Flux Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -918,7 +853,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration]
@@ -932,7 +866,7 @@ def list(
)
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -943,19 +877,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -966,14 +898,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -983,11 +914,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -999,7 +930,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py
index e65c80971ffb0..884da9f639c83 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._location_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,11 +57,11 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""List all Extension Types.
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType]
@@ -73,7 +75,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,16 +86,14 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -104,14 +104,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -121,11 +120,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -137,7 +136,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_operations.py
index ff0ee219540b9..6902c3dd30db5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -86,12 +88,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -107,7 +108,7 @@ async def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -116,16 +117,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -135,16 +134,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -155,6 +150,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -172,7 +168,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -187,7 +182,7 @@ def list(
)
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -198,19 +193,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -221,14 +214,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -238,11 +230,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -254,7 +246,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operations.py
index 05cdddfce379c..35fce66fb9d5c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -72,7 +74,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,14 +85,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -101,14 +101,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -118,11 +117,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,5 +133,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py
index c52b755d27577..72657b722eefe 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -91,13 +95,12 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -113,7 +116,7 @@ async def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -121,16 +124,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -140,16 +141,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -190,7 +187,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
@@ -205,7 +201,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -231,11 +227,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
@@ -250,7 +245,7 @@ async def create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -273,19 +268,16 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -310,7 +302,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -321,16 +313,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -340,22 +330,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.ExtensionsClusterRp],
@@ -363,8 +345,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -378,9 +360,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -388,31 +370,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -444,14 +429,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -467,7 +444,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -479,11 +456,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -492,17 +470,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -513,6 +487,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -530,7 +505,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -545,7 +519,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -556,19 +530,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -579,14 +551,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -596,11 +567,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -612,7 +583,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py
index 1a246be645352..03c1ae1e3018d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py
@@ -5,70 +5,81 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import BucketDefinition
-from ._models_py3 import BucketPatchDefinition
-from ._models_py3 import ClusterScopeSettings
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import DependsOnDefinition
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionType
-from ._models_py3 import ExtensionTypeList
-from ._models_py3 import ExtensionVersionList
-from ._models_py3 import ExtensionVersionListVersionsItem
-from ._models_py3 import ExtensionsList
-from ._models_py3 import FluxConfiguration
-from ._models_py3 import FluxConfigurationPatch
-from ._models_py3 import FluxConfigurationsList
-from ._models_py3 import GitRepositoryDefinition
-from ._models_py3 import GitRepositoryPatchDefinition
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import HelmReleasePropertiesDefinition
-from ._models_py3 import Identity
-from ._models_py3 import KustomizationDefinition
-from ._models_py3 import KustomizationPatchDefinition
-from ._models_py3 import ObjectReferenceDefinition
-from ._models_py3 import ObjectStatusConditionDefinition
-from ._models_py3 import ObjectStatusDefinition
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import ProxyResource
-from ._models_py3 import RepositoryRefDefinition
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SupportedScopes
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import ClusterTypes
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import ExtensionsClusterResourceName
-from ._source_control_configuration_client_enums import ExtensionsClusterRp
-from ._source_control_configuration_client_enums import FluxComplianceState
-from ._source_control_configuration_client_enums import KustomizationValidationType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import ProvisioningStateType
-from ._source_control_configuration_client_enums import ScopeType
-from ._source_control_configuration_client_enums import SourceKindType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ BucketDefinition,
+ BucketPatchDefinition,
+ ClusterScopeSettings,
+ ComplianceStatus,
+ DependsOnDefinition,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionType,
+ ExtensionTypeList,
+ ExtensionVersionList,
+ ExtensionVersionListVersionsItem,
+ ExtensionsList,
+ FluxConfiguration,
+ FluxConfigurationPatch,
+ FluxConfigurationsList,
+ GitRepositoryDefinition,
+ GitRepositoryPatchDefinition,
+ HelmOperatorProperties,
+ HelmReleasePropertiesDefinition,
+ Identity,
+ KustomizationDefinition,
+ KustomizationPatchDefinition,
+ ObjectReferenceDefinition,
+ ObjectStatusConditionDefinition,
+ ObjectStatusDefinition,
+ OperationStatusList,
+ OperationStatusResult,
+ PatchExtension,
+ ProxyResource,
+ RepositoryRefDefinition,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SupportedScopes,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ ClusterTypes,
+ ComplianceStateType,
+ CreatedByType,
+ ExtensionsClusterResourceName,
+ ExtensionsClusterRp,
+ FluxComplianceState,
+ KustomizationValidationType,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningState,
+ ProvisioningStateType,
+ ScopeType,
+ SourceKindType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -133,5 +144,5 @@
"ScopeType",
"SourceKindType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py
index e234708e30ac9..b4bc68415efd7 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -179,7 +172,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -215,7 +208,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -224,22 +217,6 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
class ClusterScopeSettings(ProxyResource):
"""Extension scope settings.
@@ -247,7 +224,7 @@ class ClusterScopeSettings(ProxyResource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -463,13 +440,13 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -479,7 +456,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData
:ivar extension_type: Type of the Extension, of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the
@@ -880,13 +857,13 @@ def __init__(
self.versions = versions
-class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class FluxConfiguration(ProxyResource):
"""The Flux Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -894,7 +871,7 @@ class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-att
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData
:ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and
"namespace".
@@ -1804,7 +1781,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -2176,13 +2153,13 @@ def __init__(self, *, target_namespace: Optional[str] = None, **kwargs: Any) ->
self.target_namespace = target_namespace
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -2190,7 +2167,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/__init__.py
index ccd968835618a..481b03e4d653f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/__init__.py
@@ -5,20 +5,26 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -33,5 +39,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py
index f3fee0568d160..538326f515d90 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -125,12 +127,11 @@ def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +147,7 @@ def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -154,16 +155,14 @@ def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -173,13 +172,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py
index ae617157c07d5..a91c14cef86d3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -122,7 +124,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType]
@@ -136,7 +137,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -147,19 +148,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -170,14 +169,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -187,11 +185,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -203,7 +201,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py
index 8bf65b6ec468f..c10f859f35be3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -89,13 +91,13 @@ def __init__(self, *args, **kwargs):
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> Iterable["_models.ExtensionVersionListVersionsItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListVersionsItem or the result of
cls(response)
:rtype:
@@ -110,7 +112,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,17 +123,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -142,14 +142,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -159,11 +158,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -175,7 +174,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py
index fe5d26568faf4..fe64a82ff744d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -302,7 +307,7 @@ def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -312,7 +317,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -323,40 +328,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -394,14 +394,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -416,7 +408,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -441,18 +433,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -467,7 +451,7 @@ def begin_create(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -490,19 +474,9 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension or
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -534,12 +508,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -551,17 +526,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -592,12 +565,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +585,7 @@ def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -621,16 +593,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -640,18 +610,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.ExtensionsClusterRp],
@@ -660,8 +626,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -675,9 +641,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -686,31 +652,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -746,14 +715,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -769,7 +730,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -782,11 +743,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -797,17 +759,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -816,10 +774,10 @@ def _update_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -834,7 +792,7 @@ def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -844,7 +802,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -855,35 +813,34 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@overload
def begin_update(
@@ -923,14 +880,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -945,7 +894,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -970,18 +919,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -996,7 +937,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -1019,20 +960,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -1064,12 +994,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1081,17 +1012,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1119,7 +1048,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension]
@@ -1133,7 +1061,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1144,19 +1072,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1167,14 +1093,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1184,11 +1109,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1200,7 +1125,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py
index 19ba39ee3906c..34eb00712bad2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -130,12 +132,11 @@ def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -151,7 +152,7 @@ def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -160,16 +161,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -179,13 +178,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py
index 875ac53d00498..a7cf811831aeb 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -306,12 +311,11 @@ def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -327,7 +331,7 @@ def get(
)
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -335,16 +339,14 @@ def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -354,16 +356,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
@@ -372,10 +370,10 @@ def _create_or_update_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -390,7 +388,7 @@ def _create_or_update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -400,7 +398,7 @@ def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -411,40 +409,35 @@ def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -483,14 +476,6 @@ def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -506,7 +491,7 @@ def begin_create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -531,18 +516,10 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -558,7 +535,7 @@ def begin_create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -581,20 +558,9 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -627,12 +593,13 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -644,17 +611,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
def _update_initial(
self,
@@ -663,10 +628,10 @@ def _update_initial(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -681,7 +646,7 @@ def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -691,7 +656,7 @@ def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -702,35 +667,34 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def begin_update(
@@ -771,14 +735,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -794,7 +750,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -820,18 +776,10 @@ def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -847,7 +795,7 @@ def begin_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -870,20 +818,10 @@ def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch or
+ IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -916,12 +854,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -933,19 +872,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.ExtensionsClusterRp],
@@ -954,8 +891,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -969,9 +906,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -980,31 +917,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -1040,14 +980,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -1063,7 +995,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -1076,11 +1008,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -1091,17 +1024,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -1129,7 +1058,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration]
@@ -1143,7 +1071,7 @@ def list(
)
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1154,19 +1082,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1177,14 +1103,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -1194,11 +1119,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1210,7 +1135,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py
index 3c85640074595..914b52aef8121 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -90,7 +92,6 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType]
@@ -104,7 +105,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -115,16 +116,14 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -135,14 +134,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -152,11 +150,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -168,7 +166,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py
index 95d1325a8a79b..8452b2676c7dc 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -172,12 +174,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -193,7 +194,7 @@ def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -202,16 +203,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -221,16 +220,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -241,6 +236,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -258,7 +254,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -273,7 +268,7 @@ def list(
)
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -284,19 +279,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -307,14 +300,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -324,11 +316,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -340,7 +332,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operations.py
index 3a9521765c978..4344047737a35 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -77,9 +79,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
)
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,14 +107,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -123,14 +123,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -140,11 +139,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -156,5 +155,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py
index ae5b59f85194e..7e849f3eba298 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -263,13 +267,12 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -285,7 +288,7 @@ def get(
)
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -293,16 +296,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -312,16 +313,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -362,7 +359,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
@@ -377,7 +373,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -403,11 +399,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
@@ -422,7 +417,7 @@ def create_or_update(
cluster_resource_name: Union[str, _models.ExtensionsClusterResourceName],
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -445,19 +440,16 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration or
+ IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -482,7 +474,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -493,16 +485,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -512,22 +502,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: Union[str, _models.ExtensionsClusterRp],
@@ -535,8 +517,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -550,9 +532,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -560,31 +542,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -616,14 +601,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -639,7 +616,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -651,11 +628,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -664,17 +642,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -685,6 +659,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> Iterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -702,7 +677,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -717,7 +691,7 @@ def list(
)
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -728,19 +702,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -751,14 +723,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -768,11 +739,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -784,7 +755,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_configuration.py
index b085ca16ba07f..31293522b6773 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-01-15-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_metadata.json
index 10af1ff6f1712..8eb300cf560db 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": false,
+ "has_public_lro_operations": false,
"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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"cluster_extension_type": "ClusterExtensionTypeOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_source_control_configuration_client.py
index fd70ce3bc80aa..5278035541a36 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -23,11 +26,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar cluster_extension_type: ClusterExtensionTypeOperations operations
@@ -63,7 +65,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -82,7 +102,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-01-15-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -102,12 +122,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_configuration.py
index 1982229795f8d..73cab3e3b287a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-01-15-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_source_control_configuration_client.py
index 1a33faa9ceb00..960ed5a86299b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -23,11 +26,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar cluster_extension_type: ClusterExtensionTypeOperations operations
@@ -63,7 +65,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -82,7 +102,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-01-15-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -102,12 +124,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/__init__.py
index 0d057f1ce4bbf..28ddef0453ba3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/__init__.py
@@ -5,14 +5,20 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -21,5 +27,5 @@
"ExtensionTypeVersionsOperations",
"LocationExtensionTypesOperations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_type_operations.py
index 3cb1d072e73a0..ab4bba0348991 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._cluster_extension_type_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,12 +82,11 @@ async def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,7 +102,7 @@ async def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -109,16 +110,14 @@ async def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -128,13 +127,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_types_operations.py
index f51e8e5be4155..098c0fe0ba26a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._cluster_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -62,6 +64,7 @@ def list(
cluster_name: str,
**kwargs: Any
) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""Get Extension Types.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -79,7 +82,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionType]
@@ -93,7 +95,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,19 +106,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -127,14 +127,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -144,11 +143,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -160,7 +159,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_extension_type_versions_operations.py
index 3da56fe0b59e1..5eaec6f266f9e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._extension_type_versions_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> AsyncIterable["_models.ExtensionVersionListValueItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListValueItem or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,17 +91,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -110,14 +110,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -127,11 +126,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -143,7 +142,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_location_extension_types_operations.py
index e5b5dfc65e1bc..fd103e73956d1 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/aio/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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._location_extension_types_operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,11 +57,11 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ExtensionType"]:
+ # pylint: disable=line-too-long
"""List all Extension Types.
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionType]
@@ -73,7 +75,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,16 +86,14 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Extension
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -104,14 +104,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -121,11 +120,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -137,7 +136,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/__init__.py
index 69f0a0668b1b9..7fadcd5de2c64 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/__init__.py
@@ -5,25 +5,36 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ClusterScopeSettings
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import ExtensionType
-from ._models_py3 import ExtensionTypeList
-from ._models_py3 import ExtensionVersionList
-from ._models_py3 import ExtensionVersionListValueItem
-from ._models_py3 import ProxyResource
-from ._models_py3 import Resource
-from ._models_py3 import SupportedScopes
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import ExtensionsClusterResourceName
-from ._source_control_configuration_client_enums import ExtensionsClusterRp
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ClusterScopeSettings,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ ExtensionType,
+ ExtensionTypeList,
+ ExtensionVersionList,
+ ExtensionVersionListValueItem,
+ ProxyResource,
+ Resource,
+ SupportedScopes,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ CreatedByType,
+ ExtensionsClusterResourceName,
+ ExtensionsClusterRp,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -43,5 +54,5 @@
"ExtensionsClusterResourceName",
"ExtensionsClusterRp",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/_models_py3.py
index 499f18c6c23ff..8f26d5b288f8d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/models/_models_py3.py
@@ -1,5 +1,4 @@
# 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.
@@ -13,7 +12,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -150,7 +148,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -186,7 +184,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -195,22 +193,6 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
class ExtensionType(ProxyResource):
"""Represents an Extension Type.
@@ -218,7 +200,7 @@ class ExtensionType(ProxyResource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/__init__.py
index 0d057f1ce4bbf..28ddef0453ba3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/__init__.py
@@ -5,14 +5,20 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._cluster_extension_type_operations import ClusterExtensionTypeOperations
-from ._cluster_extension_types_operations import ClusterExtensionTypesOperations
-from ._extension_type_versions_operations import ExtensionTypeVersionsOperations
-from ._location_extension_types_operations import LocationExtensionTypesOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._cluster_extension_type_operations import ClusterExtensionTypeOperations # type: ignore
+from ._cluster_extension_types_operations import ClusterExtensionTypesOperations # type: ignore
+from ._extension_type_versions_operations import ExtensionTypeVersionsOperations # type: ignore
+from ._location_extension_types_operations import LocationExtensionTypesOperations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -21,5 +27,5 @@
"ExtensionTypeVersionsOperations",
"LocationExtensionTypesOperations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_type_operations.py
index 36948d962772d..b605f5af3f48d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_type_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_type_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -125,12 +127,11 @@ def get(
:type cluster_name: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ExtensionType or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionType
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +147,7 @@ def get(
)
cls: ClsType[_models.ExtensionType] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -154,16 +155,14 @@ def get(
extension_type_name=extension_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -173,13 +172,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionType", pipeline_response)
+ deserialized = self._deserialize("ExtensionType", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_types_operations.py
index 6d40c4511f1c5..669acb122160b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_cluster_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -122,7 +124,6 @@ def list(
~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionsClusterResourceName
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionType]
@@ -136,7 +137,7 @@ def list(
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -147,19 +148,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -170,14 +169,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -187,11 +185,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -203,7 +201,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_extension_type_versions_operations.py
index 94f6e384bd346..6d6fbb9cc880a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_extension_type_versions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_extension_type_versions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -89,13 +91,13 @@ def __init__(self, *args, **kwargs):
def list(
self, location: str, extension_type_name: str, **kwargs: Any
) -> Iterable["_models.ExtensionVersionListValueItem"]:
+ # pylint: disable=line-too-long
"""List available versions for an Extension Type.
:param location: extension location. Required.
:type location: str
:param extension_type_name: Extension type name. Required.
:type extension_type_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExtensionVersionListValueItem or the result of
cls(response)
:rtype:
@@ -110,7 +112,7 @@ def list(
)
cls: ClsType[_models.ExtensionVersionList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,17 +123,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
location=location,
extension_type_name=extension_type_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -142,14 +142,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionVersionList", pipeline_response)
@@ -159,11 +158,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -175,7 +174,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_location_extension_types_operations.py
index 025fc98db4e98..e257216d1a3f3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_location_extension_types_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_15_preview/operations/_location_extension_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -90,7 +92,6 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
:param location: extension location. 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 ExtensionType or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_15_preview.models.ExtensionType]
@@ -104,7 +105,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
)
cls: ClsType[_models.ExtensionTypeList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -115,16 +116,14 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ExtensionType"
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -135,14 +134,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionTypeList", pipeline_response)
@@ -152,11 +150,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -168,7 +166,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_configuration.py
index 901c9932c4575..ff9a622ed06e8 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-03-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_metadata.json
index 017fa56adc285..b9ed5dd4a3607 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_source_control_configuration_client.py
index 1b33057b82105..12ea07a15c452 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,7 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +135,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_configuration.py
index cbd57d78dd791..c6cb1bc506651 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-03-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_source_control_configuration_client.py
index 12f9951eeea70..7b03fd2ef6bb3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,9 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +137,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_extensions_operations.py
index 7f1e8cbb8a0e1..577c3c312fa28 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,7 +90,7 @@ async def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -96,7 +100,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,40 +111,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -174,14 +173,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -197,7 +188,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -218,18 +209,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -245,7 +228,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -264,19 +247,8 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -307,12 +279,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -325,17 +298,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -362,12 +333,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -381,7 +351,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -389,16 +359,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -408,18 +376,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -428,8 +392,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -441,9 +405,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -452,31 +416,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -508,14 +475,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -529,7 +488,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -542,11 +501,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -558,17 +518,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -577,10 +533,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -593,7 +549,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -603,7 +559,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -614,40 +570,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_update(
self,
@@ -681,14 +632,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -704,7 +647,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -725,18 +668,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -752,7 +687,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -771,20 +706,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -815,12 +739,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -833,17 +758,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -862,7 +785,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -874,7 +796,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -885,19 +807,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -908,14 +828,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -925,11 +844,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -941,7 +860,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py
index ddf3ab8726314..57955b0fda2b7 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_config_operation_status_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,12 +81,11 @@ async def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,7 +99,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,16 +108,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -126,13 +125,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_configurations_operations.py
index 3e48b0c766e95..76e481fe4c85b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_flux_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -88,12 +92,11 @@ async def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -107,7 +110,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -115,16 +118,14 @@ async def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,16 +135,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
@@ -152,10 +149,10 @@ async def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -168,7 +165,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -178,7 +175,7 @@ async def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -189,40 +186,35 @@ async def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -257,14 +249,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -280,7 +264,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -301,18 +285,10 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -328,7 +304,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -347,20 +323,9 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -391,12 +356,13 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -409,17 +375,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
async def _update_initial(
self,
@@ -428,10 +392,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -444,7 +408,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -454,7 +418,7 @@ async def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -465,40 +429,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_update(
self,
@@ -534,14 +493,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -557,7 +508,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -579,18 +530,10 @@ async def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -606,7 +549,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -625,20 +568,9 @@ async def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -669,12 +601,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -687,19 +620,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -708,8 +639,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -721,9 +652,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -732,31 +663,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -788,14 +722,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -809,7 +735,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -822,11 +748,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -838,22 +765,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.FluxConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Flux Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -867,7 +791,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration]
@@ -879,7 +802,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -890,19 +813,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -913,14 +834,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -930,11 +850,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -946,7 +866,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operation_status_operations.py
index 81249e8a4390b..070b00626cd48 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -82,12 +84,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,7 +102,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -110,16 +111,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -129,21 +128,18 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -157,7 +153,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -170,7 +165,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,19 +176,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -204,14 +197,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -221,11 +213,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -237,7 +229,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operations.py
index 7c887547ff71c..ce9d408005e48 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -70,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -99,14 +99,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -116,11 +115,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -132,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_source_control_configurations_operations.py
index db372a07617f3..35880fb198efe 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -87,12 +91,11 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +109,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -114,16 +117,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -133,16 +134,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -179,7 +176,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -193,7 +189,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -215,11 +211,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -233,7 +228,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -252,18 +247,14 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +277,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -297,16 +288,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -316,22 +305,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -339,8 +320,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,9 +333,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -362,31 +343,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,14 +398,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -435,7 +411,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -447,11 +423,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -460,22 +437,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -489,7 +463,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -502,7 +475,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -513,19 +486,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -536,14 +507,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -553,11 +523,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -569,7 +539,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/__init__.py
index ff57672e9e1ae..290280992dbba 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/__init__.py
@@ -5,61 +5,72 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import BucketDefinition
-from ._models_py3 import BucketPatchDefinition
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionsList
-from ._models_py3 import FluxConfiguration
-from ._models_py3 import FluxConfigurationPatch
-from ._models_py3 import FluxConfigurationsList
-from ._models_py3 import GitRepositoryDefinition
-from ._models_py3 import GitRepositoryPatchDefinition
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import HelmReleasePropertiesDefinition
-from ._models_py3 import Identity
-from ._models_py3 import KustomizationDefinition
-from ._models_py3 import KustomizationPatchDefinition
-from ._models_py3 import ObjectReferenceDefinition
-from ._models_py3 import ObjectStatusConditionDefinition
-from ._models_py3 import ObjectStatusDefinition
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import ProxyResource
-from ._models_py3 import RepositoryRefDefinition
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import AKSIdentityType
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import FluxComplianceState
-from ._source_control_configuration_client_enums import KustomizationValidationType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import ProvisioningStateType
-from ._source_control_configuration_client_enums import ScopeType
-from ._source_control_configuration_client_enums import SourceKindType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ BucketDefinition,
+ BucketPatchDefinition,
+ ComplianceStatus,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionsList,
+ FluxConfiguration,
+ FluxConfigurationPatch,
+ FluxConfigurationsList,
+ GitRepositoryDefinition,
+ GitRepositoryPatchDefinition,
+ HelmOperatorProperties,
+ HelmReleasePropertiesDefinition,
+ Identity,
+ KustomizationDefinition,
+ KustomizationPatchDefinition,
+ ObjectReferenceDefinition,
+ ObjectStatusConditionDefinition,
+ ObjectStatusDefinition,
+ OperationStatusList,
+ OperationStatusResult,
+ PatchExtension,
+ ProxyResource,
+ RepositoryRefDefinition,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ AKSIdentityType,
+ ComplianceStateType,
+ CreatedByType,
+ FluxComplianceState,
+ KustomizationValidationType,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningState,
+ ProvisioningStateType,
+ ScopeType,
+ SourceKindType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -115,5 +126,5 @@
"ScopeType",
"SourceKindType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/_models_py3.py
index e208891ff7314..f84e1fda645e0 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -327,7 +320,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -363,7 +356,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -372,30 +365,14 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -405,7 +382,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SystemData
:ivar extension_type: Type of the Extension, of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the
@@ -666,13 +643,13 @@ def __init__(
self.time = time
-class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class FluxConfiguration(ProxyResource):
"""The Flux Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -680,7 +657,7 @@ class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-att
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SystemData
:ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and
"namespace".
@@ -1594,7 +1571,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -1964,13 +1941,13 @@ def __init__(self, *, target_namespace: Optional[str] = None, **kwargs: Any) ->
self.target_namespace = target_namespace
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -1978,7 +1955,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_extensions_operations.py
index c43eaf86431d2..c0ee6cc90ff97 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +305,7 @@ def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -310,7 +315,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -321,40 +326,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -388,14 +388,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -410,7 +402,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -431,18 +423,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -457,7 +441,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -476,19 +460,8 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -518,12 +491,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -535,17 +509,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -572,12 +544,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +562,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -599,16 +570,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -618,18 +587,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -638,8 +603,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -651,9 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -662,31 +627,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -718,14 +686,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -739,7 +699,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -752,11 +712,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -767,17 +728,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -786,10 +743,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -802,7 +759,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -812,7 +769,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -823,40 +780,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_update(
self,
@@ -890,14 +842,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -912,7 +856,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -933,18 +877,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -959,7 +895,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -978,20 +914,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -1021,12 +946,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1038,17 +964,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1067,7 +991,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.Extension]
@@ -1079,7 +1002,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1090,19 +1013,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1113,14 +1034,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1130,11 +1050,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1146,7 +1066,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_config_operation_status_operations.py
index ee9d9793c7753..4e9ebae396d72 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -126,12 +128,11 @@ def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +146,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -154,16 +155,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -173,13 +172,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_configurations_operations.py
index 453b4b6917f80..2e99b6bfda70a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_flux_configurations_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -302,12 +307,11 @@ def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,7 +325,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -329,16 +333,14 @@ def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -348,16 +350,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
@@ -366,10 +364,10 @@ def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -382,7 +380,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -392,7 +390,7 @@ def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -403,40 +401,35 @@ def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -471,14 +464,6 @@ def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -494,7 +479,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -515,18 +500,10 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -542,7 +519,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -561,20 +538,9 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -605,12 +571,13 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -622,17 +589,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
def _update_initial(
self,
@@ -641,10 +606,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,7 +622,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -667,7 +632,7 @@ def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -678,40 +643,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_update(
self,
@@ -747,14 +707,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -770,7 +722,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -792,18 +744,10 @@ def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -819,7 +763,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -838,20 +782,9 @@ def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -882,12 +815,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -899,19 +833,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -920,8 +852,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -933,9 +865,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -944,31 +876,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -1000,14 +935,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -1021,7 +948,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -1034,11 +961,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -1049,17 +977,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -1078,7 +1002,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.FluxConfiguration]
@@ -1090,7 +1013,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1101,19 +1024,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1124,14 +1045,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -1141,11 +1061,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1157,7 +1077,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operation_status_operations.py
index 61d10136d7221..986f8dcf70d1f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -168,12 +170,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +188,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -196,16 +197,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -215,16 +214,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -243,7 +238,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -256,7 +250,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -267,19 +261,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -290,14 +282,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -307,11 +298,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -323,7 +314,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operations.py
index 6a8be8ef06bfa..b5551c8f3808e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -92,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,14 +104,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -121,14 +120,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -138,11 +136,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -154,5 +152,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_source_control_configurations_operations.py
index c1ce306ac5a50..0fc11a294c7c1 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_03_01/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -259,12 +263,11 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -278,7 +281,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -286,16 +289,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -305,16 +306,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -351,7 +348,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -365,7 +361,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -387,11 +383,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -405,7 +400,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -424,18 +419,14 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_03_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +449,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -469,16 +460,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -488,22 +477,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -511,8 +492,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -524,9 +505,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -534,31 +515,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -586,14 +570,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -607,7 +583,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -619,11 +595,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -632,17 +609,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -661,7 +634,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -674,7 +646,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -685,19 +657,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -708,14 +678,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -725,11 +694,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -741,7 +710,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_configuration.py
index d5ad6bc0537e2..03ae9d05de1f2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-04-02-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_metadata.json
index 1a2102404ed06..ff938f87a9dec 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_source_control_configuration_client.py
index 5571dd7332559..b507f216d83ac 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -24,11 +27,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -69,7 +71,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -91,7 +111,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-04-02-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -111,12 +131,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_configuration.py
index eae71fd28f31c..c4cb858bff88f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-04-02-preview")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_source_control_configuration_client.py
index f05fa1943cefe..2dc5eaf91181b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -24,11 +27,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -69,7 +71,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -91,7 +111,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-04-02-preview"
)
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -111,12 +133,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/__init__.py
index 15e6d84b033d2..222ddd73ed2e6 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._private_link_scopes_operations import PrivateLinkScopesOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._private_link_scopes_operations import PrivateLinkScopesOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -23,5 +29,5 @@
"PrivateLinkResourcesOperations",
"PrivateEndpointConnectionsOperations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_extensions_operations.py
index 4cc2713f83e69..d9523e497bed7 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,7 +92,7 @@ async def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -98,7 +102,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -109,40 +113,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -176,14 +175,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -199,7 +190,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -220,18 +211,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -247,7 +230,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -266,19 +249,9 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension or
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -311,12 +284,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -329,17 +303,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -366,12 +338,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -387,7 +358,7 @@ async def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -395,16 +366,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -414,18 +383,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -434,8 +399,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -449,9 +414,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -460,31 +425,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -516,14 +484,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -539,7 +499,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -552,11 +512,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -568,17 +529,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -587,10 +544,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -605,7 +562,7 @@ async def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -615,7 +572,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -626,40 +583,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_update(
self,
@@ -694,14 +646,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -717,7 +661,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -738,18 +682,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -765,7 +701,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -784,20 +720,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension:
- ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PatchExtension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PatchExtension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -830,12 +755,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -848,22 +774,21 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.Extension"]:
+ # pylint: disable=line-too-long
"""List all Extensions in the cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -877,7 +802,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -891,7 +815,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -902,19 +826,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -925,14 +847,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -942,11 +863,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -958,7 +879,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_operation_status_operations.py
index 9f087bc9c24a7..88e06078ffa86 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,12 +81,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,7 +101,7 @@ async def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -109,16 +110,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -128,13 +127,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py
index ad136c8304581..e9857eac061fc 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,19 +15,19 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._private_endpoint_connections_operations import (
build_create_or_update_request,
build_delete_request,
@@ -35,6 +35,10 @@
build_list_by_private_link_scope_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -73,13 +77,12 @@ async def get(
:param private_endpoint_connection_name: The name of the private endpoint connection associated
with the Azure resource. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,22 +98,20 @@ async def get(
)
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
scope_name=scope_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)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -120,26 +121,22 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
scope_name: str,
private_endpoint_connection_name: str,
- properties: Union[_models.PrivateEndpointConnection, IO],
+ properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PrivateEndpointConnection]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -154,7 +151,7 @@ async def _create_or_update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -164,7 +161,7 @@ async def _create_or_update_initial(
else:
_json = self._serialize.body(properties, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -173,37 +170,34 @@ async def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@overload
async def begin_create_or_update(
@@ -216,6 +210,7 @@ async def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
+ # pylint: disable=line-too-long
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -232,14 +227,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -253,11 +240,12 @@ async def begin_create_or_update(
resource_group_name: str,
scope_name: str,
private_endpoint_connection_name: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
+ # pylint: disable=line-too-long
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -269,18 +257,10 @@ async def begin_create_or_update(
with the Azure resource. Required.
:type private_endpoint_connection_name: str
:param properties: The private endpoint connection properties. Required.
- :type properties: IO
+ :type properties: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -294,9 +274,10 @@ async def begin_create_or_update(
resource_group_name: str,
scope_name: str,
private_endpoint_connection_name: str,
- properties: Union[_models.PrivateEndpointConnection, IO],
+ properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
+ # pylint: disable=line-too-long
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -308,20 +289,10 @@ async def begin_create_or_update(
with the Azure resource. Required.
:type private_endpoint_connection_name: str
:param properties: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.kubernetesconfiguration.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
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PrivateEndpointConnection or
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -352,12 +323,13 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -367,22 +339,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[_models.PrivateEndpointConnection](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,39 +366,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
scope_name=scope_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -444,14 +417,6 @@ async def begin_delete(
:param private_endpoint_connection_name: The name of the private endpoint connection associated
with the Azure resource. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -467,7 +432,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
scope_name=scope_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -477,11 +442,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -490,17 +456,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace_async
async def list_by_private_link_scope(
@@ -513,13 +475,12 @@ async def list_by_private_link_scope(
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_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.kubernetesconfiguration.v2022_04_02_preview.models.PrivateEndpointConnectionListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -535,21 +496,19 @@ async def list_by_private_link_scope(
)
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- request = build_list_by_private_link_scope_request(
+ _request = build_list_by_private_link_scope_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_private_link_scope.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -559,13 +518,9 @@ async def list_by_private_link_scope(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- list_by_private_link_scope.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py
index 0292fbb80141d..06a3419a5d435 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._private_link_resources_operations import build_get_request, build_list_by_private_link_scope_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -62,13 +64,12 @@ async def list_by_private_link_scope(
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResourceListResult or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PrivateLinkResourceListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,21 +85,19 @@ async def list_by_private_link_scope(
)
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- request = build_list_by_private_link_scope_request(
+ _request = build_list_by_private_link_scope_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_private_link_scope.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -108,16 +107,12 @@ async def list_by_private_link_scope(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- list_by_private_link_scope.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateLinkResources"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -132,12 +127,11 @@ async def get(
:type scope_name: str
:param group_name: The name of the private link resource. Required.
:type group_name: 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.kubernetesconfiguration.v2022_04_02_preview.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -153,22 +147,20 @@ async def get(
)
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -178,13 +170,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_scopes_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_scopes_operations.py
index 80dbd766d43ba..8e78dac638094 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_scopes_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/aio/operations/_private_link_scopes_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._private_link_scopes_operations import (
build_create_or_update_request,
build_delete_request,
@@ -40,6 +40,10 @@
build_update_tags_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -66,9 +70,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.KubernetesConfigurationPrivateLinkScope"]:
+ # pylint: disable=line-too-long
"""Gets a list of all Azure Arc PrivateLinkScopes within a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either KubernetesConfigurationPrivateLinkScope or the
result of cls(response)
:rtype:
@@ -83,7 +87,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.KubernetesConfigurationP
)
cls: ClsType[_models.KubernetesConfigurationPrivateLinkScopeListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -94,15 +98,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.KubernetesConfigurationP
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -113,14 +115,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScopeListResult", pipeline_response)
@@ -130,11 +131,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -147,20 +148,16 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes"
- }
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> AsyncIterable["_models.KubernetesConfigurationPrivateLinkScope"]:
+ # pylint: disable=line-too-long
"""Gets a list of Azure Arc PrivateLinkScopes within a 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 KubernetesConfigurationPrivateLinkScope or the
result of cls(response)
:rtype:
@@ -175,7 +172,7 @@ def list_by_resource_group(
)
cls: ClsType[_models.KubernetesConfigurationPrivateLinkScopeListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -186,16 +183,14 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_resource_group.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -206,14 +201,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScopeListResult", pipeline_response)
@@ -223,11 +217,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -240,14 +234,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, scope_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ async def _delete_initial(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -261,38 +249,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
scope_name=scope_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -303,14 +294,6 @@ async def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -326,7 +309,7 @@ async def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
scope_name=scope_name,
api_version=api_version,
@@ -335,11 +318,12 @@ async def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -348,17 +332,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace_async
async def get(
@@ -371,13 +351,12 @@ async def get(
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -393,21 +372,19 @@ async def get(
)
cls: ClsType[_models.KubernetesConfigurationPrivateLinkScope] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -417,16 +394,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response)
+ deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -453,7 +426,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -465,7 +437,7 @@ async def create_or_update(
self,
resource_group_name: str,
scope_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -480,11 +452,10 @@ async def create_or_update(
:type scope_name: str
:param parameters: Properties that need to be specified to create or update a Azure Arc for
Servers and Clusters PrivateLinkScope. Required.
- :type parameters: IO
+ :type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -496,7 +467,7 @@ async def create_or_update(
self,
resource_group_name: str,
scope_name: str,
- parameters: Union[_models.KubernetesConfigurationPrivateLinkScope, IO],
+ parameters: Union[_models.KubernetesConfigurationPrivateLinkScope, IO[bytes]],
**kwargs: Any
) -> _models.KubernetesConfigurationPrivateLinkScope:
"""Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value
@@ -509,20 +480,16 @@ async def create_or_update(
:type scope_name: str
:param parameters: Properties that need to be specified to create or update a Azure Arc for
Servers and Clusters PrivateLinkScope. Is either a KubernetesConfigurationPrivateLinkScope type
- or a IO type. Required.
+ or a IO[bytes] type. Required.
:type parameters:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ or IO[bytes]
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -547,7 +514,7 @@ async def create_or_update(
else:
_json = self._serialize.body(parameters, "KubernetesConfigurationPrivateLinkScope")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
@@ -555,16 +522,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -574,21 +539,13 @@ async def create_or_update(
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("KubernetesConfigurationPrivateLinkScope", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response)
+ deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
-
@overload
async def update_tags(
self,
@@ -614,7 +571,6 @@ async def update_tags(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -626,7 +582,7 @@ async def update_tags(
self,
resource_group_name: str,
scope_name: str,
- private_link_scope_tags: IO,
+ private_link_scope_tags: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -641,11 +597,10 @@ async def update_tags(
:type scope_name: str
:param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope
instance. Required.
- :type private_link_scope_tags: IO
+ :type private_link_scope_tags: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -657,7 +612,7 @@ async def update_tags(
self,
resource_group_name: str,
scope_name: str,
- private_link_scope_tags: Union[_models.TagsResource, IO],
+ private_link_scope_tags: Union[_models.TagsResource, IO[bytes]],
**kwargs: Any
) -> _models.KubernetesConfigurationPrivateLinkScope:
"""Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate
@@ -669,19 +624,15 @@ async def update_tags(
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
:param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope
- instance. Is either a TagsResource type or a IO type. Required.
+ instance. Is either a TagsResource type or a IO[bytes] type. Required.
:type private_link_scope_tags:
- ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.TagsResource or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.TagsResource or IO[bytes]
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -706,7 +657,7 @@ async def update_tags(
else:
_json = self._serialize.body(private_link_scope_tags, "TagsResource")
- request = build_update_tags_request(
+ _request = build_update_tags_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
@@ -714,16 +665,14 @@ async def update_tags(
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)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -733,13 +682,9 @@ async def update_tags(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response)
+ deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update_tags.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/__init__.py
index f4352e3aa45c4..5a5d790ea5759 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/__init__.py
@@ -5,46 +5,57 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionsList
-from ._models_py3 import Identity
-from ._models_py3 import KubernetesConfigurationPrivateLinkScope
-from ._models_py3 import KubernetesConfigurationPrivateLinkScopeListResult
-from ._models_py3 import KubernetesConfigurationPrivateLinkScopeProperties
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import Plan
-from ._models_py3 import PrivateEndpoint
-from ._models_py3 import PrivateEndpointConnection
-from ._models_py3 import PrivateEndpointConnectionListResult
-from ._models_py3 import PrivateLinkResource
-from ._models_py3 import PrivateLinkResourceListResult
-from ._models_py3 import PrivateLinkServiceConnectionState
-from ._models_py3 import ProxyResource
-from ._models_py3 import Resource
-from ._models_py3 import ResourceAutoGenerated
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import SystemData
-from ._models_py3 import TagsResource
-from ._models_py3 import TrackedResource
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import AKSIdentityType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import PrivateEndpointConnectionProvisioningState
-from ._source_control_configuration_client_enums import PrivateEndpointServiceConnectionStatus
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import PublicNetworkAccessType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionsList,
+ Identity,
+ KubernetesConfigurationPrivateLinkScope,
+ KubernetesConfigurationPrivateLinkScopeListResult,
+ KubernetesConfigurationPrivateLinkScopeProperties,
+ OperationStatusResult,
+ PatchExtension,
+ Plan,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourceListResult,
+ PrivateLinkServiceConnectionState,
+ ProxyResource,
+ Resource,
+ ResourceAutoGenerated,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ SystemData,
+ TagsResource,
+ TrackedResource,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ AKSIdentityType,
+ CreatedByType,
+ LevelType,
+ PrivateEndpointConnectionProvisioningState,
+ PrivateEndpointServiceConnectionStatus,
+ ProvisioningState,
+ PublicNetworkAccessType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -85,5 +96,5 @@
"ProvisioningState",
"PublicNetworkAccessType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_models_py3.py
index 2b1b2e168cedd..198d51cc0ede9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -123,7 +116,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -159,7 +152,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -168,30 +161,14 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -201,7 +178,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.SystemData
:ivar plan: The plan information.
:vartype plan: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Plan
@@ -514,7 +491,7 @@ class ResourceAutoGenerated(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -555,10 +532,10 @@ class TrackedResource(ResourceAutoGenerated):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -608,10 +585,10 @@ class KubernetesConfigurationPrivateLinkScope(TrackedResource):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -663,16 +640,16 @@ def __init__(
:paramtype location: str
:keyword properties: Properties that define a Azure Arc PrivateLinkScope resource.
:paramtype properties:
- ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScopeProperties
+ ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScopeProperties # pylint: disable=line-too-long
"""
super().__init__(tags=tags, location=location, **kwargs)
self.properties = properties
-class KubernetesConfigurationPrivateLinkScopeListResult(_serialization.Model):
+class KubernetesConfigurationPrivateLinkScopeListResult(_serialization.Model): # pylint: disable=name-too-long
"""Describes the list of Azure Arc PrivateLinkScope resources.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar value: List of Azure Arc PrivateLinkScope definitions. Required.
:vartype value:
@@ -711,12 +688,12 @@ def __init__(
self.next_link = next_link
-class KubernetesConfigurationPrivateLinkScopeProperties(_serialization.Model):
+class KubernetesConfigurationPrivateLinkScopeProperties(_serialization.Model): # pylint: disable=name-too-long
"""Properties that define a Azure Arc PrivateLinkScope 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.
+ All required parameters must be populated in order to send to server.
:ivar public_network_access: Indicates whether machines associated with the private link scope
can also use public Azure Arc service endpoints. Known values are: "Enabled" and "Disabled".
@@ -783,7 +760,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -903,7 +880,7 @@ def __init__(
class Plan(_serialization.Model):
"""Plan for the resource.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required.
:vartype name: str
@@ -996,7 +973,7 @@ class PrivateEndpointConnection(ResourceAutoGenerated):
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -1090,7 +1067,7 @@ class PrivateLinkResource(ResourceAutoGenerated):
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_source_control_configuration_client_enums.py
index 6a06958deeb8f..1afd691e7edd1 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_source_control_configuration_client_enums.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/models/_source_control_configuration_client_enums.py
@@ -69,7 +69,7 @@ class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
ENABLED = "Enabled"
"""Allows Azure Arc agents to communicate with Azure Arc services over both public (internet) and
- #: private endpoints."""
+ private endpoints."""
DISABLED = "Disabled"
"""Does not allow Azure Arc agents to communicate with Azure Arc services over public (internet)
- #: endpoints. The agents must use the private link."""
+ endpoints. The agents must use the private link."""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/__init__.py
index 15e6d84b033d2..222ddd73ed2e6 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._private_link_scopes_operations import PrivateLinkScopesOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._private_link_scopes_operations import PrivateLinkScopesOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -23,5 +29,5 @@
"PrivateLinkResourcesOperations",
"PrivateEndpointConnectionsOperations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_extensions_operations.py
index abeaea2bf0627..469cfb6fdf7f0 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -302,7 +307,7 @@ def _create_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -312,7 +317,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -323,40 +328,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -390,14 +390,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -412,7 +404,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -433,18 +425,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -459,7 +443,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -478,19 +462,9 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension or
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -522,12 +496,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -539,17 +514,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -576,12 +549,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -597,7 +569,7 @@ def get(
)
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -605,16 +577,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -624,18 +594,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -644,8 +610,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -659,9 +625,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -670,31 +636,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -726,14 +695,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -749,7 +710,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -762,11 +723,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -777,17 +739,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -796,10 +754,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -814,7 +772,7 @@ def _update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -824,7 +782,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -835,40 +793,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_update(
self,
@@ -903,14 +856,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -925,7 +870,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -946,18 +891,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -972,7 +909,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -991,20 +928,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension:
- ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PatchExtension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PatchExtension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -1036,12 +962,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1053,17 +980,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1082,7 +1007,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.Extension]
@@ -1096,7 +1020,7 @@ def list(
)
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1107,19 +1031,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1130,14 +1052,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1147,11 +1068,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1163,7 +1084,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_operation_status_operations.py
index 87234da1ebff2..ac3894caf57fc 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -126,12 +128,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -147,7 +148,7 @@ def get(
)
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -156,16 +157,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -175,13 +174,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py
index 2223b85cf3f94..e368cd8ac2eda 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,12 +15,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -28,8 +29,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -227,13 +231,12 @@ def get(
:param private_endpoint_connection_name: The name of the private endpoint connection associated
with the Azure resource. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -249,22 +252,20 @@ def get(
)
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
scope_name=scope_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)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -274,26 +275,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
resource_group_name: str,
scope_name: str,
private_endpoint_connection_name: str,
- properties: Union[_models.PrivateEndpointConnection, IO],
+ properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PrivateEndpointConnection]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -308,7 +305,7 @@ def _create_or_update_initial(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -318,7 +315,7 @@ def _create_or_update_initial(
else:
_json = self._serialize.body(properties, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -327,37 +324,34 @@ def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@overload
def begin_create_or_update(
@@ -370,6 +364,7 @@ def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
+ # pylint: disable=line-too-long
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -386,14 +381,6 @@ def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -407,11 +394,12 @@ def begin_create_or_update(
resource_group_name: str,
scope_name: str,
private_endpoint_connection_name: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
+ # pylint: disable=line-too-long
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -423,18 +411,10 @@ def begin_create_or_update(
with the Azure resource. Required.
:type private_endpoint_connection_name: str
:param properties: The private endpoint connection properties. Required.
- :type properties: IO
+ :type properties: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -448,9 +428,10 @@ def begin_create_or_update(
resource_group_name: str,
scope_name: str,
private_endpoint_connection_name: str,
- properties: Union[_models.PrivateEndpointConnection, IO],
+ properties: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
+ # pylint: disable=line-too-long
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -462,20 +443,10 @@ def begin_create_or_update(
with the Azure resource. Required.
:type private_endpoint_connection_name: str
:param properties: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.kubernetesconfiguration.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
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PrivateEndpointConnection or
+ IO[bytes]
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -506,12 +477,13 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -521,22 +493,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[_models.PrivateEndpointConnection](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -550,39 +520,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
scope_name=scope_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -598,14 +571,6 @@ def begin_delete(
:param private_endpoint_connection_name: The name of the private endpoint connection associated
with the Azure resource. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -621,7 +586,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
scope_name=scope_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -631,11 +596,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -644,17 +610,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list_by_private_link_scope(
@@ -667,13 +629,12 @@ def list_by_private_link_scope(
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_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.kubernetesconfiguration.v2022_04_02_preview.models.PrivateEndpointConnectionListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -689,21 +650,19 @@ def list_by_private_link_scope(
)
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- request = build_list_by_private_link_scope_request(
+ _request = build_list_by_private_link_scope_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_private_link_scope.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -713,13 +672,9 @@ def list_by_private_link_scope(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- list_by_private_link_scope.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateEndpointConnections"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_resources_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_resources_operations.py
index 10a286028a657..91a0cd07343f8 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_resources_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_resources_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -132,13 +134,12 @@ def list_by_private_link_scope(
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResourceListResult or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.PrivateLinkResourceListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -154,21 +155,19 @@ def list_by_private_link_scope(
)
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- request = build_list_by_private_link_scope_request(
+ _request = build_list_by_private_link_scope_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_private_link_scope.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -178,16 +177,12 @@ def list_by_private_link_scope(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- list_by_private_link_scope.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateLinkResources"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -202,12 +197,11 @@ def get(
:type scope_name: str
:param group_name: The name of the private link resource. Required.
:type group_name: 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.kubernetesconfiguration.v2022_04_02_preview.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -223,22 +217,20 @@ def get(
)
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -248,13 +240,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_scopes_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_scopes_operations.py
index c2ddb4707104b..42e35d9ce28dc 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_scopes_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_04_02_preview/operations/_private_link_scopes_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -251,9 +255,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.KubernetesConfigurationPrivateLinkScope"]:
+ # pylint: disable=line-too-long
"""Gets a list of all Azure Arc PrivateLinkScopes within a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either KubernetesConfigurationPrivateLinkScope or the
result of cls(response)
:rtype:
@@ -268,7 +272,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.KubernetesConfigurationPrivat
)
cls: ClsType[_models.KubernetesConfigurationPrivateLinkScopeListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -279,15 +283,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.KubernetesConfigurationPrivat
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -298,14 +300,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScopeListResult", pipeline_response)
@@ -315,11 +316,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -332,20 +333,16 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes"
- }
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, **kwargs: Any
) -> Iterable["_models.KubernetesConfigurationPrivateLinkScope"]:
+ # pylint: disable=line-too-long
"""Gets a list of Azure Arc PrivateLinkScopes within a 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 KubernetesConfigurationPrivateLinkScope or the
result of cls(response)
:rtype:
@@ -360,7 +357,7 @@ def list_by_resource_group(
)
cls: ClsType[_models.KubernetesConfigurationPrivateLinkScopeListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -371,16 +368,14 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_resource_group.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -391,14 +386,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScopeListResult", pipeline_response)
@@ -408,11 +402,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -425,14 +419,8 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, scope_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -446,38 +434,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-04-02-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
scope_name=scope_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -488,14 +479,6 @@ def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any)
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -511,7 +494,7 @@ def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
scope_name=scope_name,
api_version=api_version,
@@ -520,11 +503,12 @@ def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any)
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -533,17 +517,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def get(
@@ -556,13 +536,12 @@ def get(
:type resource_group_name: str
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -578,21 +557,19 @@ def get(
)
cls: ClsType[_models.KubernetesConfigurationPrivateLinkScope] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -602,16 +579,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response)
+ deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -638,7 +611,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -650,7 +622,7 @@ def create_or_update(
self,
resource_group_name: str,
scope_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -665,11 +637,10 @@ def create_or_update(
:type scope_name: str
:param parameters: Properties that need to be specified to create or update a Azure Arc for
Servers and Clusters PrivateLinkScope. Required.
- :type parameters: IO
+ :type parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -681,7 +652,7 @@ def create_or_update(
self,
resource_group_name: str,
scope_name: str,
- parameters: Union[_models.KubernetesConfigurationPrivateLinkScope, IO],
+ parameters: Union[_models.KubernetesConfigurationPrivateLinkScope, IO[bytes]],
**kwargs: Any
) -> _models.KubernetesConfigurationPrivateLinkScope:
"""Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value
@@ -694,20 +665,16 @@ def create_or_update(
:type scope_name: str
:param parameters: Properties that need to be specified to create or update a Azure Arc for
Servers and Clusters PrivateLinkScope. Is either a KubernetesConfigurationPrivateLinkScope type
- or a IO type. Required.
+ or a IO[bytes] type. Required.
:type parameters:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ or IO[bytes]
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -732,7 +699,7 @@ def create_or_update(
else:
_json = self._serialize.body(parameters, "KubernetesConfigurationPrivateLinkScope")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
@@ -740,16 +707,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -759,21 +724,13 @@ def create_or_update(
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("KubernetesConfigurationPrivateLinkScope", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response)
+ deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
-
@overload
def update_tags(
self,
@@ -799,7 +756,6 @@ def update_tags(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -811,7 +767,7 @@ def update_tags(
self,
resource_group_name: str,
scope_name: str,
- private_link_scope_tags: IO,
+ private_link_scope_tags: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -826,11 +782,10 @@ def update_tags(
:type scope_name: str
:param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope
instance. Required.
- :type private_link_scope_tags: IO
+ :type private_link_scope_tags: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
@@ -842,7 +797,7 @@ def update_tags(
self,
resource_group_name: str,
scope_name: str,
- private_link_scope_tags: Union[_models.TagsResource, IO],
+ private_link_scope_tags: Union[_models.TagsResource, IO[bytes]],
**kwargs: Any
) -> _models.KubernetesConfigurationPrivateLinkScope:
"""Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate
@@ -854,19 +809,15 @@ def update_tags(
:param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required.
:type scope_name: str
:param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope
- instance. Is either a TagsResource type or a IO type. Required.
+ instance. Is either a TagsResource type or a IO[bytes] type. Required.
:type private_link_scope_tags:
- ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.TagsResource or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.TagsResource or IO[bytes]
:return: KubernetesConfigurationPrivateLinkScope or the result of cls(response)
:rtype:
~azure.mgmt.kubernetesconfiguration.v2022_04_02_preview.models.KubernetesConfigurationPrivateLinkScope
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -891,7 +842,7 @@ def update_tags(
else:
_json = self._serialize.body(private_link_scope_tags, "TagsResource")
- request = build_update_tags_request(
+ _request = build_update_tags_request(
resource_group_name=resource_group_name,
scope_name=scope_name,
subscription_id=self._config.subscription_id,
@@ -899,16 +850,14 @@ def update_tags(
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)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -918,13 +867,9 @@ def update_tags(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response)
+ deserialized = self._deserialize("KubernetesConfigurationPrivateLinkScope", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update_tags.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KubernetesConfiguration/privateLinkScopes/{scopeName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_configuration.py
index 1851ea84ed791..8a8722c913c1b 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-07-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_metadata.json
index fa22caeda3c09..8f7d204854141 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_source_control_configuration_client.py
index c025b35837cfb..948fd89b72fbf 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,7 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-07-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +135,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_configuration.py
index 2e30cac2641f1..0a26c3de4a533 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-07-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_source_control_configuration_client.py
index f8f73c7c3e0ee..adc2f9cf67b3f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,9 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-07-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +137,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_extensions_operations.py
index c0a6ed4f06651..3c4612afe260c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,7 +90,7 @@ async def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -96,7 +100,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,40 +111,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -174,14 +173,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -197,7 +188,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -218,18 +209,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -245,7 +228,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -264,19 +247,8 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -307,12 +279,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -325,17 +298,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -362,12 +333,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -381,7 +351,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -389,16 +359,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -408,18 +376,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -428,8 +392,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -441,9 +405,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -452,31 +416,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -508,14 +475,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -529,7 +488,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -542,11 +501,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -558,17 +518,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -577,10 +533,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -593,7 +549,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -603,7 +559,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -614,40 +570,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_update(
self,
@@ -681,14 +632,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -704,7 +647,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -725,18 +668,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -752,7 +687,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -771,20 +706,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -815,12 +739,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -833,17 +758,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -862,7 +785,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -874,7 +796,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -885,19 +807,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -908,14 +828,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -925,11 +844,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -941,7 +860,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_config_operation_status_operations.py
index 63dded1264ace..4d5b4d75ad1f9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_config_operation_status_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,12 +81,11 @@ async def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,7 +99,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,16 +108,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -126,13 +125,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_configurations_operations.py
index 00fca3f58ba3e..90c9729fe25c5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_flux_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -88,12 +92,11 @@ async def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -107,7 +110,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -115,16 +118,14 @@ async def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,16 +135,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
@@ -152,10 +149,10 @@ async def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -168,7 +165,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -178,7 +175,7 @@ async def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -189,40 +186,35 @@ async def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -257,14 +249,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -280,7 +264,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -301,18 +285,10 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -328,7 +304,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -347,20 +323,9 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -391,12 +356,13 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -409,17 +375,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
async def _update_initial(
self,
@@ -428,10 +392,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -444,7 +408,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -454,7 +418,7 @@ async def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -465,40 +429,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_update(
self,
@@ -534,14 +493,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -557,7 +508,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -579,18 +530,10 @@ async def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -606,7 +549,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -625,20 +568,9 @@ async def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -669,12 +601,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -687,19 +620,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -708,8 +639,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -721,9 +652,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -732,31 +663,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -788,14 +722,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -809,7 +735,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -822,11 +748,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -838,22 +765,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.FluxConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Flux Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -867,7 +791,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration]
@@ -879,7 +802,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -890,19 +813,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -913,14 +834,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -930,11 +850,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -946,7 +866,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operation_status_operations.py
index 6920a6641f581..6cbff932f19ed 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -82,12 +84,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,7 +102,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -110,16 +111,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -129,21 +128,18 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -157,7 +153,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -170,7 +165,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,19 +176,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -204,14 +197,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -221,11 +213,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -237,7 +229,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operations.py
index 28e241d5e7e1f..f6f8a378d01a3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -70,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -99,14 +99,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -116,11 +115,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -132,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_source_control_configurations_operations.py
index bb58d19df3526..e6168a6eb4f94 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -87,12 +91,11 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +109,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -114,16 +117,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -133,16 +134,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -179,7 +176,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -193,7 +189,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -215,11 +211,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -233,7 +228,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -252,18 +247,14 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +277,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -297,16 +288,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -316,22 +305,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -339,8 +320,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,9 +333,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -362,31 +343,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,14 +398,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -435,7 +411,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -447,11 +423,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -460,22 +437,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -489,7 +463,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -502,7 +475,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -513,19 +486,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -536,14 +507,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -553,11 +523,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -569,7 +539,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/__init__.py
index ec64905f8638f..2f7bb36271b17 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/__init__.py
@@ -5,67 +5,78 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import AzureBlobDefinition
-from ._models_py3 import AzureBlobPatchDefinition
-from ._models_py3 import BucketDefinition
-from ._models_py3 import BucketPatchDefinition
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionsList
-from ._models_py3 import FluxConfiguration
-from ._models_py3 import FluxConfigurationPatch
-from ._models_py3 import FluxConfigurationsList
-from ._models_py3 import GitRepositoryDefinition
-from ._models_py3 import GitRepositoryPatchDefinition
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import HelmReleasePropertiesDefinition
-from ._models_py3 import Identity
-from ._models_py3 import KustomizationDefinition
-from ._models_py3 import KustomizationPatchDefinition
-from ._models_py3 import ManagedIdentityDefinition
-from ._models_py3 import ManagedIdentityPatchDefinition
-from ._models_py3 import ObjectReferenceDefinition
-from ._models_py3 import ObjectStatusConditionDefinition
-from ._models_py3 import ObjectStatusDefinition
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import ProxyResource
-from ._models_py3 import RepositoryRefDefinition
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import ServicePrincipalDefinition
-from ._models_py3 import ServicePrincipalPatchDefinition
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import AKSIdentityType
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import FluxComplianceState
-from ._source_control_configuration_client_enums import KustomizationValidationType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import ProvisioningStateType
-from ._source_control_configuration_client_enums import ScopeType
-from ._source_control_configuration_client_enums import SourceKindType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AzureBlobDefinition,
+ AzureBlobPatchDefinition,
+ BucketDefinition,
+ BucketPatchDefinition,
+ ComplianceStatus,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionsList,
+ FluxConfiguration,
+ FluxConfigurationPatch,
+ FluxConfigurationsList,
+ GitRepositoryDefinition,
+ GitRepositoryPatchDefinition,
+ HelmOperatorProperties,
+ HelmReleasePropertiesDefinition,
+ Identity,
+ KustomizationDefinition,
+ KustomizationPatchDefinition,
+ ManagedIdentityDefinition,
+ ManagedIdentityPatchDefinition,
+ ObjectReferenceDefinition,
+ ObjectStatusConditionDefinition,
+ ObjectStatusDefinition,
+ OperationStatusList,
+ OperationStatusResult,
+ PatchExtension,
+ ProxyResource,
+ RepositoryRefDefinition,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ ServicePrincipalDefinition,
+ ServicePrincipalPatchDefinition,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ AKSIdentityType,
+ ComplianceStateType,
+ CreatedByType,
+ FluxComplianceState,
+ KustomizationValidationType,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningState,
+ ProvisioningStateType,
+ ScopeType,
+ SourceKindType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -127,5 +138,5 @@
"ScopeType",
"SourceKindType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/_models_py3.py
index 0eaba5a2d23f9..7d06db5ab9fc8 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -513,7 +506,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -549,7 +542,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -558,30 +551,14 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -591,7 +568,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SystemData
:ivar extension_type: Type of the Extension, of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the
@@ -852,13 +829,13 @@ def __init__(
self.time = time
-class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class FluxConfiguration(ProxyResource):
"""The Flux Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -866,7 +843,7 @@ class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-att
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SystemData
:ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and
"namespace".
@@ -1837,7 +1814,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -2341,13 +2318,13 @@ def __init__(
self.client_certificate_send_chain = client_certificate_send_chain
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -2355,7 +2332,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_extensions_operations.py
index 08aff2c65a5a5..7efbef8405a18 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +305,7 @@ def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -310,7 +315,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -321,40 +326,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -388,14 +388,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -410,7 +402,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -431,18 +423,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -457,7 +441,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -476,19 +460,8 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -518,12 +491,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -535,17 +509,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -572,12 +544,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +562,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -599,16 +570,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -618,18 +587,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -638,8 +603,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -651,9 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -662,31 +627,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -718,14 +686,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -739,7 +699,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -752,11 +712,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -767,17 +728,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -786,10 +743,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -802,7 +759,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -812,7 +769,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -823,40 +780,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_update(
self,
@@ -890,14 +842,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -912,7 +856,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -933,18 +877,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -959,7 +895,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -978,20 +914,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -1021,12 +946,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1038,17 +964,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1067,7 +991,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.Extension]
@@ -1079,7 +1002,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1090,19 +1013,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1113,14 +1034,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1130,11 +1050,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1146,7 +1066,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_config_operation_status_operations.py
index 843a69d3dd2dc..32c3c520a39e6 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -126,12 +128,11 @@ def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +146,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -154,16 +155,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -173,13 +172,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_configurations_operations.py
index df36e4cb7858a..f70d30cee14b2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_flux_configurations_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -302,12 +307,11 @@ def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,7 +325,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -329,16 +333,14 @@ def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -348,16 +350,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
@@ -366,10 +364,10 @@ def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -382,7 +380,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -392,7 +390,7 @@ def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -403,40 +401,35 @@ def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -471,14 +464,6 @@ def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -494,7 +479,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -515,18 +500,10 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -542,7 +519,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -561,20 +538,9 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -605,12 +571,13 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -622,17 +589,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
def _update_initial(
self,
@@ -641,10 +606,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,7 +622,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -667,7 +632,7 @@ def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -678,40 +643,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_update(
self,
@@ -747,14 +707,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -770,7 +722,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -792,18 +744,10 @@ def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -819,7 +763,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -838,20 +782,9 @@ def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -882,12 +815,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -899,19 +833,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -920,8 +852,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -933,9 +865,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -944,31 +876,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -1000,14 +935,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -1021,7 +948,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -1034,11 +961,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -1049,17 +977,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -1078,7 +1002,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.FluxConfiguration]
@@ -1090,7 +1013,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1101,19 +1024,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1124,14 +1045,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -1141,11 +1061,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1157,7 +1077,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operation_status_operations.py
index c051db3929626..5df2fa303985a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -168,12 +170,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +188,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -196,16 +197,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -215,16 +214,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -243,7 +238,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -256,7 +250,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -267,19 +261,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -290,14 +282,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -307,11 +298,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -323,7 +314,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operations.py
index d93877dcde9cb..8d4a32c419d2a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -92,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,14 +104,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -121,14 +120,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -138,11 +136,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -154,5 +152,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_source_control_configurations_operations.py
index 0db34d178601b..a6cd0ca34721f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_07_01/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -259,12 +263,11 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -278,7 +281,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -286,16 +289,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -305,16 +306,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -351,7 +348,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -365,7 +361,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -387,11 +383,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -405,7 +400,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -424,18 +419,14 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_07_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +449,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -469,16 +460,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -488,22 +477,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -511,8 +492,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -524,9 +505,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -534,31 +515,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -586,14 +570,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -607,7 +583,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -619,11 +595,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -632,17 +609,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -661,7 +634,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -674,7 +646,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-07-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -685,19 +657,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -708,14 +678,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -725,11 +694,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -741,7 +710,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_configuration.py
index b6c088d194588..25e066e9975d4 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-11-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_metadata.json
index 59fdaab4a1cdc..00c7e9ffdc2b5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_source_control_configuration_client.py
index ae76060d4eb7a..0f335817e321f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,7 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-11-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +135,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_configuration.py
index 28a2f8c282d08..208bc628a218c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-11-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_source_control_configuration_client.py
index 1d25068a8fd6a..152bb9e3c21f6 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,9 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-11-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +137,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_extensions_operations.py
index 261c4fd56fbca..30ddc4180d507 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,7 +90,7 @@ async def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -96,7 +100,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,40 +111,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -174,14 +173,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -197,7 +188,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -218,18 +209,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -245,7 +228,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -264,19 +247,8 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -307,12 +279,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -325,17 +298,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -362,12 +333,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -381,7 +351,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -389,16 +359,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -408,18 +376,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -428,8 +392,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -441,9 +405,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -452,31 +416,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -508,14 +475,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -529,7 +488,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -542,11 +501,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -558,17 +518,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -577,10 +533,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -593,7 +549,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -603,7 +559,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -614,40 +570,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_update(
self,
@@ -681,14 +632,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -704,7 +647,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -725,18 +668,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -752,7 +687,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -771,20 +706,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -815,12 +739,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -833,17 +758,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -862,7 +785,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -874,7 +796,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -885,19 +807,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -908,14 +828,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -925,11 +844,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -941,7 +860,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_config_operation_status_operations.py
index 5d0cea59f1cc0..5a64f8acddb06 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_config_operation_status_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,12 +81,11 @@ async def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,7 +99,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,16 +108,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -126,13 +125,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_configurations_operations.py
index 19f0768638db4..87df8e2972b02 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_flux_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -88,12 +92,11 @@ async def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -107,7 +110,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -115,16 +118,14 @@ async def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,16 +135,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
@@ -152,10 +149,10 @@ async def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -168,7 +165,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -178,7 +175,7 @@ async def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -189,40 +186,35 @@ async def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -257,14 +249,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -280,7 +264,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -301,18 +285,10 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -328,7 +304,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -347,20 +323,9 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -391,12 +356,13 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -409,17 +375,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
async def _update_initial(
self,
@@ -428,10 +392,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -444,7 +408,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -454,7 +418,7 @@ async def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -465,40 +429,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_update(
self,
@@ -534,14 +493,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -557,7 +508,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -579,18 +530,10 @@ async def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -606,7 +549,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -625,20 +568,9 @@ async def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -669,12 +601,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -687,19 +620,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -708,8 +639,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -721,9 +652,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -732,31 +663,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -788,14 +722,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -809,7 +735,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -822,11 +748,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -838,22 +765,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.FluxConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Flux Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -867,7 +791,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration]
@@ -879,7 +802,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -890,19 +813,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -913,14 +834,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -930,11 +850,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -946,7 +866,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operation_status_operations.py
index fb3cc73775755..d473cffee10bd 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -82,12 +84,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,7 +102,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -110,16 +111,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -129,21 +128,18 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -157,7 +153,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -170,7 +165,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,19 +176,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -204,14 +197,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -221,11 +213,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -237,7 +229,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operations.py
index bc80b8395f1d4..f397169fb7455 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -70,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -99,14 +99,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -116,11 +115,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -132,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_source_control_configurations_operations.py
index 18ff02ed5be24..25e938dcc0718 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -87,12 +91,11 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +109,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -114,16 +117,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -133,16 +134,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -179,7 +176,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -193,7 +189,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -215,11 +211,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -233,7 +228,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -252,18 +247,14 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +277,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -297,16 +288,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -316,22 +305,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -339,8 +320,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,9 +333,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -362,31 +343,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,14 +398,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -435,7 +411,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -447,11 +423,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -460,22 +437,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -489,7 +463,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -502,7 +475,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -513,19 +486,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -536,14 +507,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -553,11 +523,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -569,7 +539,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/__init__.py
index 0ae6f6df11e08..fb77f13b69b72 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/__init__.py
@@ -5,68 +5,79 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import AzureBlobDefinition
-from ._models_py3 import AzureBlobPatchDefinition
-from ._models_py3 import BucketDefinition
-from ._models_py3 import BucketPatchDefinition
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionsList
-from ._models_py3 import FluxConfiguration
-from ._models_py3 import FluxConfigurationPatch
-from ._models_py3 import FluxConfigurationsList
-from ._models_py3 import GitRepositoryDefinition
-from ._models_py3 import GitRepositoryPatchDefinition
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import HelmReleasePropertiesDefinition
-from ._models_py3 import Identity
-from ._models_py3 import KustomizationDefinition
-from ._models_py3 import KustomizationPatchDefinition
-from ._models_py3 import ManagedIdentityDefinition
-from ._models_py3 import ManagedIdentityPatchDefinition
-from ._models_py3 import ObjectReferenceDefinition
-from ._models_py3 import ObjectStatusConditionDefinition
-from ._models_py3 import ObjectStatusDefinition
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import Plan
-from ._models_py3 import ProxyResource
-from ._models_py3 import RepositoryRefDefinition
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import ServicePrincipalDefinition
-from ._models_py3 import ServicePrincipalPatchDefinition
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import AKSIdentityType
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import FluxComplianceState
-from ._source_control_configuration_client_enums import KustomizationValidationType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import ProvisioningStateType
-from ._source_control_configuration_client_enums import ScopeType
-from ._source_control_configuration_client_enums import SourceKindType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AzureBlobDefinition,
+ AzureBlobPatchDefinition,
+ BucketDefinition,
+ BucketPatchDefinition,
+ ComplianceStatus,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionsList,
+ FluxConfiguration,
+ FluxConfigurationPatch,
+ FluxConfigurationsList,
+ GitRepositoryDefinition,
+ GitRepositoryPatchDefinition,
+ HelmOperatorProperties,
+ HelmReleasePropertiesDefinition,
+ Identity,
+ KustomizationDefinition,
+ KustomizationPatchDefinition,
+ ManagedIdentityDefinition,
+ ManagedIdentityPatchDefinition,
+ ObjectReferenceDefinition,
+ ObjectStatusConditionDefinition,
+ ObjectStatusDefinition,
+ OperationStatusList,
+ OperationStatusResult,
+ PatchExtension,
+ Plan,
+ ProxyResource,
+ RepositoryRefDefinition,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ ServicePrincipalDefinition,
+ ServicePrincipalPatchDefinition,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ AKSIdentityType,
+ ComplianceStateType,
+ CreatedByType,
+ FluxComplianceState,
+ KustomizationValidationType,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningState,
+ ProvisioningStateType,
+ ScopeType,
+ SourceKindType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -129,5 +140,5 @@
"ScopeType",
"SourceKindType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/_models_py3.py
index 105d1bd735726..39aafc12312b5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -513,7 +506,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -549,7 +542,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -558,30 +551,14 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -591,7 +568,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SystemData
:ivar plan: The plan information.
:vartype plan: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Plan
@@ -864,13 +841,13 @@ def __init__(
self.time = time
-class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class FluxConfiguration(ProxyResource):
"""The Flux Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -878,7 +855,7 @@ class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-att
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SystemData
:ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and
"namespace".
@@ -1849,7 +1826,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -1969,7 +1946,7 @@ def __init__(
class Plan(_serialization.Model):
"""Plan for the resource.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required.
:vartype name: str
@@ -2420,13 +2397,13 @@ def __init__(
self.client_certificate_send_chain = client_certificate_send_chain
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -2434,7 +2411,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_extensions_operations.py
index c72de7e3a1d56..0b58c0a4eba1e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +305,7 @@ def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -310,7 +315,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -321,40 +326,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -388,14 +388,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -410,7 +402,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -431,18 +423,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -457,7 +441,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -476,19 +460,8 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -518,12 +491,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -535,17 +509,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -572,12 +544,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +562,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -599,16 +570,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -618,18 +587,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -638,8 +603,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -651,9 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -662,31 +627,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -718,14 +686,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -739,7 +699,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -752,11 +712,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -767,17 +728,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -786,10 +743,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -802,7 +759,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -812,7 +769,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -823,40 +780,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_update(
self,
@@ -890,14 +842,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -912,7 +856,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -933,18 +877,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -959,7 +895,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -978,20 +914,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -1021,12 +946,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1038,17 +964,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1067,7 +991,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.Extension]
@@ -1079,7 +1002,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1090,19 +1013,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1113,14 +1034,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1130,11 +1050,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1146,7 +1066,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_config_operation_status_operations.py
index d55b1535f4df2..783399578dc96 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -126,12 +128,11 @@ def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +146,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -154,16 +155,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -173,13 +172,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_configurations_operations.py
index e8efacf95eddf..4097cdef4783d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_flux_configurations_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -302,12 +307,11 @@ def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,7 +325,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -329,16 +333,14 @@ def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -348,16 +350,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
@@ -366,10 +364,10 @@ def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -382,7 +380,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -392,7 +390,7 @@ def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -403,40 +401,35 @@ def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -471,14 +464,6 @@ def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -494,7 +479,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -515,18 +500,10 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -542,7 +519,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -561,20 +538,9 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -605,12 +571,13 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -622,17 +589,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
def _update_initial(
self,
@@ -641,10 +606,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,7 +622,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -667,7 +632,7 @@ def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -678,40 +643,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_update(
self,
@@ -747,14 +707,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -770,7 +722,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -792,18 +744,10 @@ def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -819,7 +763,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -838,20 +782,9 @@ def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -882,12 +815,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -899,19 +833,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -920,8 +852,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -933,9 +865,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -944,31 +876,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -1000,14 +935,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -1021,7 +948,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -1034,11 +961,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -1049,17 +977,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -1078,7 +1002,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.FluxConfiguration]
@@ -1090,7 +1013,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1101,19 +1024,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1124,14 +1045,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -1141,11 +1061,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1157,7 +1077,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operation_status_operations.py
index b6f21b299e928..a0cc5099fbd40 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -168,12 +170,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +188,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -196,16 +197,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -215,16 +214,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -243,7 +238,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -256,7 +250,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -267,19 +261,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -290,14 +282,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -307,11 +298,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -323,7 +314,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operations.py
index 6ed286aaa80fe..9909de8ae3636 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -92,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,14 +104,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -121,14 +120,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -138,11 +136,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -154,5 +152,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_source_control_configurations_operations.py
index 9e028f87f53b5..32f72ec32e06f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_11_01/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -259,12 +263,11 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -278,7 +281,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -286,16 +289,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -305,16 +306,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -351,7 +348,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -365,7 +361,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -387,11 +383,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -405,7 +400,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -424,18 +419,14 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2022_11_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +449,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -469,16 +460,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -488,22 +477,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -511,8 +492,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -524,9 +505,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -534,31 +515,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -586,14 +570,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -607,7 +583,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -619,11 +595,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -632,17 +609,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -661,7 +634,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -674,7 +646,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-11-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -685,19 +657,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -708,14 +678,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -725,11 +694,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -741,7 +710,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/__init__.py
index 3ad4bd8b604e5..962b782d98078 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/__init__.py
@@ -5,15 +5,21 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
from ._version import VERSION
__version__ = VERSION
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -21,6 +27,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_configuration.py
index 04ecbde73e8c3..e8512e008cd1f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_configuration.py
@@ -8,18 +8,16 @@
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
from ._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-05-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_metadata.json
index 754698b4f6522..ded131fd57034 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_metadata.json
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_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\": [\"SourceControlConfigurationClientConfiguration\"], \".._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\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"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\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"extensions": "ExtensionsOperations",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_source_control_configuration_client.py
index 2436b32f0ce64..cedc80326c32d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from . import models as _models
from .._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,7 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +135,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "SourceControlConfigurationClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_vendor.py
deleted file mode 100644
index 0dafe0e287ff1..0000000000000
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# 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
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_version.py
index 47babc28d5edf..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_version.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.1.0"
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/__init__.py
index b95230ae03c54..f2a63ffc9c63e 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/__init__.py
@@ -5,12 +5,18 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._source_control_configuration_client import SourceControlConfigurationClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
try:
from ._patch import __all__ as _patch_all
- from ._patch import * # pylint: disable=unused-wildcard-import
+ from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
@@ -18,6 +24,6 @@
__all__ = [
"SourceControlConfigurationClient",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_configuration.py
index fcf3f1ae42763..2a0179f609004 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_configuration.py
@@ -8,18 +8,16 @@
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
from .._version import VERSION
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for SourceControlConfigurationClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class SourceControlConfigurationClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-05-01")
if credential is None:
@@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_source_control_configuration_client.py
index 404cad25c875a..21067f54a4546 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_source_control_configuration_client.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/_source_control_configuration_client.py
@@ -8,9 +8,12 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from .. import models as _models
from ..._serialization import Deserializer, Serializer
@@ -25,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class SourceControlConfigurationClient: # pylint: disable=client-accepts-api-version-keyword
+class SourceControlConfigurationClient:
"""KubernetesConfiguration Client.
:ivar extensions: ExtensionsOperations operations
@@ -72,7 +74,25 @@ def __init__(
self._config = SourceControlConfigurationClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
)
- self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
@@ -95,7 +115,9 @@ def __init__(
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-05-01")
- def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
@@ -115,12 +137,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
- return self._client.send_request(request_copy, **kwargs)
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "SourceControlConfigurationClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_extensions_operations.py
index 494585bd151b1..dccddc0438097 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_extensions_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extensions_operations import (
build_create_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -70,10 +74,10 @@ async def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,7 +90,7 @@ async def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -96,7 +100,7 @@ async def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,40 +111,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_create(
self,
@@ -174,14 +173,6 @@ async def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -197,7 +188,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -218,18 +209,10 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -245,7 +228,7 @@ async def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -264,19 +247,8 @@ async def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -307,12 +279,13 @@ async def begin_create(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -325,17 +298,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace_async
async def get(
@@ -362,12 +333,11 @@ async def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -381,7 +351,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -389,16 +359,14 @@ async def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -408,18 +376,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("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -428,8 +392,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -441,9 +405,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -452,31 +416,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -508,14 +475,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -529,7 +488,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -542,11 +501,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -558,17 +518,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
@@ -577,10 +533,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -593,7 +549,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -603,7 +559,7 @@ async def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -614,40 +570,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
async def begin_update(
self,
@@ -681,14 +632,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -704,7 +647,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -725,18 +668,10 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -752,7 +687,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -771,20 +706,9 @@ async def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Extension or the result of
cls(response)
:rtype:
@@ -815,12 +739,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -833,17 +758,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return AsyncLROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -862,7 +785,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -874,7 +796,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -885,19 +807,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -908,14 +828,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -925,11 +844,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -941,7 +860,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py
index 54a0d7148f970..ce6fd2e30011d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_config_operation_status_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,12 +81,11 @@ async def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,7 +99,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -107,16 +108,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -126,13 +125,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_configurations_operations.py
index f7edd199bb712..af820e6a2c45d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_flux_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._flux_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -39,6 +39,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -88,12 +92,11 @@ async def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -107,7 +110,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -115,16 +118,14 @@ async def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -134,16 +135,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
@@ -152,10 +149,10 @@ async def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -168,7 +165,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -178,7 +175,7 @@ async def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -189,40 +186,35 @@ async def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -257,14 +249,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -280,7 +264,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -301,18 +285,10 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -328,7 +304,7 @@ async def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -347,20 +323,9 @@ async def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -391,12 +356,13 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -409,17 +375,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
async def _update_initial(
self,
@@ -428,10 +392,10 @@ async def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -444,7 +408,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -454,7 +418,7 @@ async def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -465,40 +429,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
async def begin_update(
self,
@@ -534,14 +493,6 @@ async def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -557,7 +508,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -579,18 +530,10 @@ async def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -606,7 +549,7 @@ async def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -625,20 +568,9 @@ async def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -669,12 +601,13 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -687,19 +620,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -708,8 +639,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -721,9 +652,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -732,31 +663,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -788,14 +722,6 @@ async def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -809,7 +735,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -822,11 +748,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(
@@ -838,22 +765,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.FluxConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Flux Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -867,7 +791,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration]
@@ -879,7 +802,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -890,19 +813,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -913,14 +834,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -930,11 +850,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -946,7 +866,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operation_status_operations.py
index 609e62b2e18e9..07ab9a5d5d237 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operation_status_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -82,12 +84,11 @@ async def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,7 +102,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -110,16 +111,14 @@ async def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -129,21 +128,18 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.OperationStatusResult"]:
+ # pylint: disable=line-too-long
"""List Async Operations, currently in progress, in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -157,7 +153,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -170,7 +165,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,19 +176,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -204,14 +197,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -221,11 +213,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -237,7 +229,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operations.py
index dabd06b7adf90..d8bfcff60fff7 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, 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
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperation"]:
+ # pylint: disable=line-too-long
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -70,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceProviderOperatio
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -99,14 +99,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -116,11 +115,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -132,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_source_control_configurations_operations.py
index b6265dba49d30..16a02e4c1777c 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/aio/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._source_control_configurations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -87,12 +91,11 @@ async def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +109,7 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -114,16 +117,14 @@ async def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -133,16 +134,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -179,7 +176,6 @@ async def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -193,7 +189,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -215,11 +211,10 @@ async def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -233,7 +228,7 @@ async def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -252,18 +247,14 @@ async def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +277,7 @@ async def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -297,16 +288,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -316,22 +305,14 @@ async def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -339,8 +320,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,9 +333,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -362,31 +343,34 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,14 +398,6 @@ async def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: 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:
@@ -435,7 +411,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -447,11 +423,12 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -460,22 +437,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.SourceControlConfiguration"]:
+ # pylint: disable=line-too-long
"""List all Source Control Configurations.
:param resource_group_name: The name of the resource group. The name is case insensitive.
@@ -489,7 +463,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -502,7 +475,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -513,19 +486,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -536,14 +507,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -553,11 +523,11 @@ async def extract_data(pipeline_response):
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -569,7 +539,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/__init__.py
index 955dab7fdbc03..85e8e93a288d2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/__init__.py
@@ -5,70 +5,81 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._models_py3 import AzureBlobDefinition
-from ._models_py3 import AzureBlobPatchDefinition
-from ._models_py3 import BucketDefinition
-from ._models_py3 import BucketPatchDefinition
-from ._models_py3 import ComplianceStatus
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Extension
-from ._models_py3 import ExtensionPropertiesAksAssignedIdentity
-from ._models_py3 import ExtensionStatus
-from ._models_py3 import ExtensionsList
-from ._models_py3 import FluxConfiguration
-from ._models_py3 import FluxConfigurationPatch
-from ._models_py3 import FluxConfigurationsList
-from ._models_py3 import GitRepositoryDefinition
-from ._models_py3 import GitRepositoryPatchDefinition
-from ._models_py3 import HelmOperatorProperties
-from ._models_py3 import HelmReleasePropertiesDefinition
-from ._models_py3 import Identity
-from ._models_py3 import KustomizationDefinition
-from ._models_py3 import KustomizationPatchDefinition
-from ._models_py3 import ManagedIdentityDefinition
-from ._models_py3 import ManagedIdentityPatchDefinition
-from ._models_py3 import ObjectReferenceDefinition
-from ._models_py3 import ObjectStatusConditionDefinition
-from ._models_py3 import ObjectStatusDefinition
-from ._models_py3 import OperationStatusList
-from ._models_py3 import OperationStatusResult
-from ._models_py3 import PatchExtension
-from ._models_py3 import Plan
-from ._models_py3 import PostBuildDefinition
-from ._models_py3 import ProxyResource
-from ._models_py3 import RepositoryRefDefinition
-from ._models_py3 import Resource
-from ._models_py3 import ResourceProviderOperation
-from ._models_py3 import ResourceProviderOperationDisplay
-from ._models_py3 import ResourceProviderOperationList
-from ._models_py3 import Scope
-from ._models_py3 import ScopeCluster
-from ._models_py3 import ScopeNamespace
-from ._models_py3 import ServicePrincipalDefinition
-from ._models_py3 import ServicePrincipalPatchDefinition
-from ._models_py3 import SourceControlConfiguration
-from ._models_py3 import SourceControlConfigurationList
-from ._models_py3 import SubstituteFromDefinition
-from ._models_py3 import SystemData
+from typing import TYPE_CHECKING
-from ._source_control_configuration_client_enums import AKSIdentityType
-from ._source_control_configuration_client_enums import ComplianceStateType
-from ._source_control_configuration_client_enums import CreatedByType
-from ._source_control_configuration_client_enums import FluxComplianceState
-from ._source_control_configuration_client_enums import KustomizationValidationType
-from ._source_control_configuration_client_enums import LevelType
-from ._source_control_configuration_client_enums import MessageLevelType
-from ._source_control_configuration_client_enums import OperatorScopeType
-from ._source_control_configuration_client_enums import OperatorType
-from ._source_control_configuration_client_enums import ProvisioningState
-from ._source_control_configuration_client_enums import ProvisioningStateType
-from ._source_control_configuration_client_enums import ScopeType
-from ._source_control_configuration_client_enums import SourceKindType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AzureBlobDefinition,
+ AzureBlobPatchDefinition,
+ BucketDefinition,
+ BucketPatchDefinition,
+ ComplianceStatus,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Extension,
+ ExtensionPropertiesAksAssignedIdentity,
+ ExtensionStatus,
+ ExtensionsList,
+ FluxConfiguration,
+ FluxConfigurationPatch,
+ FluxConfigurationsList,
+ GitRepositoryDefinition,
+ GitRepositoryPatchDefinition,
+ HelmOperatorProperties,
+ HelmReleasePropertiesDefinition,
+ Identity,
+ KustomizationDefinition,
+ KustomizationPatchDefinition,
+ ManagedIdentityDefinition,
+ ManagedIdentityPatchDefinition,
+ ObjectReferenceDefinition,
+ ObjectStatusConditionDefinition,
+ ObjectStatusDefinition,
+ OperationStatusList,
+ OperationStatusResult,
+ PatchExtension,
+ Plan,
+ PostBuildDefinition,
+ ProxyResource,
+ RepositoryRefDefinition,
+ Resource,
+ ResourceProviderOperation,
+ ResourceProviderOperationDisplay,
+ ResourceProviderOperationList,
+ Scope,
+ ScopeCluster,
+ ScopeNamespace,
+ ServicePrincipalDefinition,
+ ServicePrincipalPatchDefinition,
+ SourceControlConfiguration,
+ SourceControlConfigurationList,
+ SubstituteFromDefinition,
+ SystemData,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ AKSIdentityType,
+ ComplianceStateType,
+ CreatedByType,
+ FluxComplianceState,
+ KustomizationValidationType,
+ LevelType,
+ MessageLevelType,
+ OperatorScopeType,
+ OperatorType,
+ ProvisioningState,
+ ProvisioningStateType,
+ ScopeType,
+ SourceKindType,
+)
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -133,5 +144,5 @@
"ScopeType",
"SourceKindType",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/_models_py3.py
index 2bc1090d26f31..90f507010ff32 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/_models_py3.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/models/_models_py3.py
@@ -1,5 +1,5 @@
-# coding=utf-8
# pylint: disable=too-many-lines
+# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -8,18 +8,11 @@
# --------------------------------------------------------------------------
import datetime
-import sys
-from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union
from ... import _serialization
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -513,7 +506,7 @@ class Resource(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -549,7 +542,7 @@ class ProxyResource(Resource):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -558,30 +551,14 @@ class ProxyResource(Resource):
: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: Any) -> None:
- """ """
- super().__init__(**kwargs)
-
-class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Extension(ProxyResource):
"""The Extension object.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -591,7 +568,7 @@ class Extension(ProxyResource): # pylint: disable=too-many-instance-attributes
:ivar identity: Identity of the Extension resource.
:vartype identity: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Identity
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SystemData
:ivar plan: The plan information.
:vartype plan: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Plan
@@ -864,13 +841,13 @@ def __init__(
self.time = time
-class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class FluxConfiguration(ProxyResource):
"""The Flux Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -878,7 +855,7 @@ class FluxConfiguration(ProxyResource): # pylint: disable=too-many-instance-att
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SystemData
:ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and
"namespace".
@@ -1903,7 +1880,7 @@ class OperationStatusResult(_serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified ID for the async operation.
:vartype id: str
@@ -2023,7 +2000,7 @@ def __init__(
class Plan(_serialization.Model):
"""Plan for the resource.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required.
:vartype name: str
@@ -2513,13 +2490,13 @@ def __init__(
self.client_certificate_send_chain = client_certificate_send_chain
-class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SourceControlConfiguration(ProxyResource):
"""The SourceControl Configuration object returned in Get & Put response.
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}.
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
@@ -2527,7 +2504,7 @@ class SourceControlConfiguration(ProxyResource): # pylint: disable=too-many-ins
"Microsoft.Storage/storageAccounts".
:vartype type: str
:ivar system_data: Top level metadata
- https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
:vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SystemData
:ivar repository_url: Url of the SourceControl Repository.
:vartype repository_url: str
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/__init__.py
index 9d58b5443a05c..d328c0efc5700 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/__init__.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/__init__.py
@@ -5,16 +5,22 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._extensions_operations import ExtensionsOperations
-from ._operation_status_operations import OperationStatusOperations
-from ._flux_configurations_operations import FluxConfigurationsOperations
-from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations
-from ._source_control_configurations_operations import SourceControlConfigurationsOperations
-from ._operations import Operations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._extensions_operations import ExtensionsOperations # type: ignore
+from ._operation_status_operations import OperationStatusOperations # type: ignore
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+from ._source_control_configurations_operations import SourceControlConfigurationsOperations # type: ignore
+from ._operations import Operations # type: ignore
from ._patch import __all__ as _patch_all
-from ._patch import * # pylint: disable=unused-wildcard-import
+from ._patch import *
from ._patch import patch_sdk as _patch_sdk
__all__ = [
@@ -25,5 +31,5 @@
"SourceControlConfigurationsOperations",
"Operations",
]
-__all__.extend([p for p in _patch_all if p not in __all__])
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_extensions_operations.py
index 824b299a08b3d..1a6ec5a4c3be8 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_extensions_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_extensions_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -284,10 +289,10 @@ def _create_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +305,7 @@ def _create_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -310,7 +315,7 @@ def _create_initial(
else:
_json = self._serialize.body(extension, "Extension")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -321,40 +326,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_create(
self,
@@ -388,14 +388,6 @@ def begin_create(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -410,7 +402,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: IO,
+ extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -431,18 +423,10 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Required.
- :type extension: IO
+ :type extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -457,7 +441,7 @@ def begin_create(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- extension: Union[_models.Extension, IO],
+ extension: Union[_models.Extension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Create a new Kubernetes Cluster Extension.
@@ -476,19 +460,8 @@ def begin_create(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param extension: Properties necessary to Create an Extension. Is either a Extension type or a
- IO type. Required.
- :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes] type. Required.
+ :type extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension or IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -518,12 +491,13 @@ def begin_create(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -535,17 +509,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def get(
@@ -572,12 +544,11 @@ def get(
:type cluster_name: str
:param extension_name: Name of the Extension. Required.
:type extension_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Extension or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +562,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -599,16 +570,14 @@ def get(
extension_name=extension_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -618,18 +587,14 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -638,8 +603,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
extension_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -651,9 +616,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -662,31 +627,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -718,14 +686,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -739,7 +699,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -752,11 +712,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -767,17 +728,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
@@ -786,10 +743,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
- ) -> _models.Extension:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -802,7 +759,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Extension] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -812,7 +769,7 @@ def _update_initial(
else:
_json = self._serialize.body(patch_extension, "PatchExtension")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -823,40 +780,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Extension", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
-
@overload
def begin_update(
self,
@@ -890,14 +842,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -912,7 +856,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: IO,
+ patch_extension: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -933,18 +877,10 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Required.
- :type patch_extension: IO
+ :type patch_extension: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -959,7 +895,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
extension_name: str,
- patch_extension: Union[_models.PatchExtension, IO],
+ patch_extension: Union[_models.PatchExtension, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Extension]:
"""Patch an existing Kubernetes Cluster Extension.
@@ -978,20 +914,9 @@ def begin_update(
:param extension_name: Name of the Extension. Required.
:type extension_name: str
:param patch_extension: Properties to Patch in an existing Extension. Is either a
- PatchExtension type or a IO type. Required.
+ PatchExtension type or a IO[bytes] type. Required.
:type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.PatchExtension or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ IO[bytes]
:return: An instance of LROPoller that returns either Extension or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -1021,12 +946,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Extension", pipeline_response)
+ deserialized = self._deserialize("Extension", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1038,17 +964,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Extension].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}"
- }
+ return LROPoller[_models.Extension](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list(
@@ -1067,7 +991,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 Extension or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.Extension]
@@ -1079,7 +1002,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.ExtensionsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1090,19 +1013,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1113,14 +1034,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExtensionsList", pipeline_response)
@@ -1130,11 +1050,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1146,7 +1066,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_config_operation_status_operations.py
index 19efb8bf2ceb3..c86d67544899a 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_config_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_config_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -126,12 +128,11 @@ def get(
:type flux_configuration_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +146,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -154,16 +155,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -173,13 +172,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_configurations_operations.py
index 96b66f0e37718..a1821bfc57ace 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_flux_configurations_operations.py
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -302,12 +307,11 @@ def get(
:type cluster_name: str
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: FluxConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,7 +325,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -329,16 +333,14 @@ def get(
flux_configuration_name=flux_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -348,16 +350,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
@@ -366,10 +364,10 @@ def _create_or_update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -382,7 +380,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -392,7 +390,7 @@ def _create_or_update_initial(
else:
_json = self._serialize.body(flux_configuration, "FluxConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -403,40 +401,35 @@ def _create_or_update_initial(
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _create_or_update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -471,14 +464,6 @@ def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -494,7 +479,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: IO,
+ flux_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -515,18 +500,10 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
- :type flux_configuration: IO
+ :type flux_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -542,7 +519,7 @@ def begin_create_or_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration: Union[_models.FluxConfiguration, IO],
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Create a new Kubernetes Flux Configuration.
@@ -561,20 +538,9 @@ def begin_create_or_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
- FluxConfiguration type or a IO type. Required.
+ FluxConfiguration type or a IO[bytes] type. Required.
:type flux_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -605,12 +571,13 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -622,17 +589,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
def _update_initial(
self,
@@ -641,10 +606,10 @@ def _update_initial(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
- ) -> _models.FluxConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,7 +622,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -667,7 +632,7 @@ def _update_initial(
else:
_json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -678,40 +643,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
-
@overload
def begin_update(
self,
@@ -747,14 +707,6 @@ def begin_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -770,7 +722,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: IO,
+ flux_configuration_patch: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -792,18 +744,10 @@ def begin_update(
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
Required.
- :type flux_configuration_patch: IO
+ :type flux_configuration_patch: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -819,7 +763,7 @@ def begin_update(
cluster_resource_name: str,
cluster_name: str,
flux_configuration_name: str,
- flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO],
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.FluxConfiguration]:
"""Update an existing Kubernetes Flux Configuration.
@@ -838,20 +782,9 @@ def begin_update(
:param flux_configuration_name: Name of the Flux Configuration. Required.
:type flux_configuration_name: str
:param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
- either a FluxConfigurationPatch type or a IO type. Required.
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
:type flux_configuration_patch:
- ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
+ ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfigurationPatch or IO[bytes]
:return: An instance of LROPoller that returns either FluxConfiguration or the result of
cls(response)
:rtype:
@@ -882,12 +815,13 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("FluxConfiguration", pipeline_response)
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -899,19 +833,17 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -920,8 +852,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
flux_configuration_name: str,
force_delete: Optional[bool] = None,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -933,9 +865,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -944,31 +876,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
subscription_id=self._config.subscription_id,
force_delete=force_delete,
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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -1000,14 +935,6 @@ def begin_delete(
:param force_delete: Delete the extension resource in Azure - not the normal asynchronous
delete. Default value is None.
:type force_delete: 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:
@@ -1021,7 +948,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -1034,11 +961,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(
@@ -1049,17 +977,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -1078,7 +1002,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 FluxConfiguration or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.FluxConfiguration]
@@ -1090,7 +1013,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1101,19 +1024,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -1124,14 +1045,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
@@ -1141,11 +1061,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -1157,7 +1077,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operation_status_operations.py
index 433206bc99ccd..41afa4639eb89 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operation_status_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operation_status_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -168,12 +170,11 @@ def get(
:type extension_name: str
:param operation_id: operation Id. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: OperationStatusResult or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.OperationStatusResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +188,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -196,16 +197,14 @@ def get(
operation_id=operation_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -215,16 +214,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("OperationStatusResult", pipeline_response)
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -243,7 +238,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 OperationStatusResult or the result of
cls(response)
:rtype:
@@ -256,7 +250,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.OperationStatusList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -267,19 +261,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -290,14 +282,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationStatusList", pipeline_response)
@@ -307,11 +298,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -323,7 +314,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operations.py
index d663549b87d1b..15e75feb079f2 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
"""List all the available operations the KubernetesConfiguration resource provider supports.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceProviderOperation or the result of
cls(response)
:rtype:
@@ -92,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.ResourceProviderOperationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,14 +104,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceProviderOperation"]:
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
api_version=api_version,
- template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -121,14 +120,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response)
@@ -138,11 +136,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -154,5 +152,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.KubernetesConfiguration/operations"}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_source_control_configurations_operations.py
index cbbb2b78173bb..6853c91d9e0da 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_source_control_configurations_operations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2023_05_01/operations/_source_control_configurations_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
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.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -259,12 +263,11 @@ def get(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -278,7 +281,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.SourceControlConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -286,16 +289,14 @@ def get(
source_control_configuration_name=source_control_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -305,16 +306,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -351,7 +348,6 @@ def create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -365,7 +361,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: IO,
+ source_control_configuration: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -387,11 +383,10 @@ def create_or_update(
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration.
Required.
- :type source_control_configuration: IO
+ :type source_control_configuration: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
@@ -405,7 +400,7 @@ def create_or_update(
cluster_resource_name: str,
cluster_name: str,
source_control_configuration_name: str,
- source_control_configuration: Union[_models.SourceControlConfiguration, IO],
+ source_control_configuration: Union[_models.SourceControlConfiguration, IO[bytes]],
**kwargs: Any
) -> _models.SourceControlConfiguration:
"""Create a new Kubernetes Source Control Configuration.
@@ -424,18 +419,14 @@ def create_or_update(
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
:param source_control_configuration: Properties necessary to Create KubernetesConfiguration. Is
- either a SourceControlConfiguration type or a IO type. Required.
+ either a SourceControlConfiguration type or a IO[bytes] type. Required.
:type source_control_configuration:
- ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration or IO[bytes]
:return: SourceControlConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.kubernetesconfiguration.v2023_05_01.models.SourceControlConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -458,7 +449,7 @@ def create_or_update(
else:
_json = self._serialize.body(source_control_configuration, "SourceControlConfiguration")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -469,16 +460,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.url = self._client.format_url(_request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -488,22 +477,14 @@ def create_or_update(
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("SourceControlConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SourceControlConfiguration", pipeline_response)
+ deserialized = self._deserialize("SourceControlConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
cluster_rp: str,
@@ -511,8 +492,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
cluster_name: str,
source_control_configuration_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -524,9 +505,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -534,31 +515,34 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
source_control_configuration_name=source_control_configuration_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)
+ _request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -586,14 +570,6 @@ def begin_delete(
:type cluster_name: str
:param source_control_configuration_name: Name of the Source Control Configuration. Required.
:type source_control_configuration_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: 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:
@@ -607,7 +583,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
@@ -619,11 +595,12 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
- return cls(pipeline_response, None, {})
+ return cls(pipeline_response, None, {}) # type: ignore
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -632,17 +609,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@distributed_trace
def list(
@@ -661,7 +634,6 @@ def list(
:type cluster_resource_name: str
:param cluster_name: The name of the kubernetes cluster. Required.
:type 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 SourceControlConfiguration or the result of
cls(response)
:rtype:
@@ -674,7 +646,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01"))
cls: ClsType[_models.SourceControlConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -685,19 +657,17 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
resource_group_name=resource_group_name,
cluster_rp=cluster_rp,
cluster_resource_name=cluster_resource_name,
cluster_name=cluster_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)
+ _request.url = self._client.format_url(_request.url)
else:
# make call to next link with the client's api-version
@@ -708,14 +678,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response)
@@ -725,11 +694,11 @@ def extract_data(pipeline_response):
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
- request = prepare_request(next_link)
+ _request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
- request, stream=_stream, **kwargs
+ _request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
@@ -741,7 +710,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations"
- }
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/__init__.py
new file mode 100644
index 0000000000000..962b782d98078
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/__init__.py
@@ -0,0 +1,32 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
+from ._version import VERSION
+
+__version__ = VERSION
+
+try:
+ from ._patch import __all__ as _patch_all
+ from ._patch import *
+except ImportError:
+ _patch_all = []
+from ._patch import patch_sdk as _patch_sdk
+
+__all__ = [
+ "SourceControlConfigurationClient",
+]
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
+
+_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_configuration.py
new file mode 100644
index 0000000000000..d5038f705a226
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_configuration.py
@@ -0,0 +1,64 @@
+# 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.pipeline import policies
+from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
+
+from ._version import VERSION
+
+if TYPE_CHECKING:
+ from azure.core.credentials import TokenCredential
+
+
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+ """Configuration for SourceControlConfigurationClient.
+
+ 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 "2024-04-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
+ :paramtype api_version: str
+ """
+
+ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
+ api_version: str = kwargs.pop("api_version", "2024-04-01-preview")
+
+ 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-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
+ 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
+ self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
+ self.authentication_policy = kwargs.get("authentication_policy")
+ if self.credential and not self.authentication_policy:
+ self.authentication_policy = ARMChallengeAuthenticationPolicy(
+ self.credential, *self.credential_scopes, **kwargs
+ )
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_metadata.json
new file mode 100644
index 0000000000000..b5040a1cd8662
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_metadata.json
@@ -0,0 +1,111 @@
+{
+ "chosen_version": "2024-04-01-preview",
+ "total_api_version_list": ["2024-04-01-preview"],
+ "client": {
+ "name": "SourceControlConfigurationClient",
+ "filename": "_source_control_configuration_client",
+ "description": "KubernetesConfiguration Client.",
+ "host_value": "\"https://management.azure.com\"",
+ "parameterized_host_template": null,
+ "azure_arm": true,
+ "has_public_lro_operations": true,
+ "client_side_validation": false,
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SourceControlConfigurationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"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,
+ "method_location": "positional"
+ },
+ "subscription_id": {
+ "signature": "subscription_id: str,",
+ "description": "The ID of the target subscription. Required.",
+ "docstring_type": "str",
+ "required": true,
+ "method_location": "positional"
+ }
+ },
+ "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: Optional[str]=None,",
+ "description": "API version to use if no profile is provided, or if missing in profile.",
+ "docstring_type": "str",
+ "required": false,
+ "method_location": "positional"
+ },
+ "base_url": {
+ "signature": "base_url: str = \"https://management.azure.com\",",
+ "description": "Service URL",
+ "docstring_type": "str",
+ "required": false,
+ "method_location": "positional"
+ },
+ "profile": {
+ "signature": "profile: KnownProfiles=KnownProfiles.default,",
+ "description": "A profile definition, from KnownProfiles to dict.",
+ "docstring_type": "azure.profiles.KnownProfiles",
+ "required": false,
+ "method_location": "positional"
+ }
+ },
+ "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,
+ "method_location": "positional"
+ },
+ "base_url": {
+ "signature": "base_url: str = \"https://management.azure.com\",",
+ "description": "Service URL",
+ "docstring_type": "str",
+ "required": false,
+ "method_location": "positional"
+ },
+ "profile": {
+ "signature": "profile: KnownProfiles = KnownProfiles.default,",
+ "description": "A profile definition, from KnownProfiles to dict.",
+ "docstring_type": "azure.profiles.KnownProfiles",
+ "required": false,
+ "method_location": "positional"
+ }
+ }
+ }
+ },
+ "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ },
+ "operation_groups": {
+ "flux_configurations": "FluxConfigurationsOperations",
+ "flux_config_operation_status": "FluxConfigOperationStatusOperations"
+ }
+}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_patch.py
new file mode 100644
index 0000000000000..f7dd32510333d
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_source_control_configuration_client.py
new file mode 100644
index 0000000000000..0911b64d44cd1
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_source_control_configuration_client.py
@@ -0,0 +1,120 @@
+# 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 typing_extensions import Self
+
+from azure.core.pipeline import policies
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
+
+from . import models as _models
+from .._serialization import Deserializer, Serializer
+from ._configuration import SourceControlConfigurationClientConfiguration
+from .operations import FluxConfigOperationStatusOperations, FluxConfigurationsOperations
+
+if TYPE_CHECKING:
+ from azure.core.credentials import TokenCredential
+
+
+class SourceControlConfigurationClient:
+ """KubernetesConfiguration Client.
+
+ :ivar flux_configurations: FluxConfigurationsOperations operations
+ :vartype flux_configurations:
+ azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.operations.FluxConfigurationsOperations
+ :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations
+ :vartype flux_config_operation_status:
+ azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.operations.FluxConfigOperationStatusOperations
+ :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 "2024-04-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
+ :paramtype api_version: str
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ """
+
+ def __init__(
+ self,
+ credential: "TokenCredential",
+ subscription_id: str,
+ base_url: str = "https://management.azure.com",
+ **kwargs: Any
+ ) -> None:
+ self._config = SourceControlConfigurationClientConfiguration(
+ credential=credential, subscription_id=subscription_id, **kwargs
+ )
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ ARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
+
+ client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
+ self._serialize = Serializer(client_models)
+ self._deserialize = Deserializer(client_models)
+ self._serialize.client_side_validation = False
+ self.flux_configurations = FluxConfigurationsOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2024-04-01-preview"
+ )
+ self.flux_config_operation_status = FluxConfigOperationStatusOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2024-04-01-preview"
+ )
+
+ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
+ """Runs the network request through the client's chained policies.
+
+ >>> from azure.core.rest import HttpRequest
+ >>> 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, stream=stream, **kwargs) # type: ignore
+
+ def close(self) -> None:
+ self._client.close()
+
+ def __enter__(self) -> Self:
+ self._client.__enter__()
+ return self
+
+ def __exit__(self, *exc_details: Any) -> None:
+ self._client.__exit__(*exc_details)
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_version.py
similarity index 58%
rename from sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_vendor.py
rename to sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_version.py
index 0dafe0e287ff1..59deb8c7263be 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_vendor.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/_version.py
@@ -1,3 +1,4 @@
+# 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.
@@ -5,12 +6,4 @@
# 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
+VERSION = "1.1.0"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/__init__.py
new file mode 100644
index 0000000000000..f2a63ffc9c63e
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/__init__.py
@@ -0,0 +1,29 @@
+# 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.
+# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._source_control_configuration_client import SourceControlConfigurationClient # type: ignore
+
+try:
+ from ._patch import __all__ as _patch_all
+ from ._patch import *
+except ImportError:
+ _patch_all = []
+from ._patch import patch_sdk as _patch_sdk
+
+__all__ = [
+ "SourceControlConfigurationClient",
+]
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
+
+_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_configuration.py
new file mode 100644
index 0000000000000..7ff33fc6d20fc
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_configuration.py
@@ -0,0 +1,64 @@
+# 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.pipeline import policies
+from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
+
+from .._version import VERSION
+
+if TYPE_CHECKING:
+ from azure.core.credentials_async import AsyncTokenCredential
+
+
+class SourceControlConfigurationClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+ """Configuration for SourceControlConfigurationClient.
+
+ 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 "2024-04-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
+ :paramtype api_version: str
+ """
+
+ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
+ api_version: str = kwargs.pop("api_version", "2024-04-01-preview")
+
+ 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-kubernetesconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
+ 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
+ self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
+ self.authentication_policy = kwargs.get("authentication_policy")
+ if self.credential and not self.authentication_policy:
+ self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
+ self.credential, *self.credential_scopes, **kwargs
+ )
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_patch.py
new file mode 100644
index 0000000000000..f7dd32510333d
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_source_control_configuration_client.py
new file mode 100644
index 0000000000000..5f4b7bb156a16
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/_source_control_configuration_client.py
@@ -0,0 +1,122 @@
+# 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 typing_extensions import Self
+
+from azure.core.pipeline import policies
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
+
+from .. import models as _models
+from ..._serialization import Deserializer, Serializer
+from ._configuration import SourceControlConfigurationClientConfiguration
+from .operations import FluxConfigOperationStatusOperations, FluxConfigurationsOperations
+
+if TYPE_CHECKING:
+ from azure.core.credentials_async import AsyncTokenCredential
+
+
+class SourceControlConfigurationClient:
+ """KubernetesConfiguration Client.
+
+ :ivar flux_configurations: FluxConfigurationsOperations operations
+ :vartype flux_configurations:
+ azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.aio.operations.FluxConfigurationsOperations
+ :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations
+ :vartype flux_config_operation_status:
+ azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.aio.operations.FluxConfigOperationStatusOperations
+ :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 "2024-04-01-preview". Note that overriding
+ this default value may result in unsupported behavior.
+ :paramtype api_version: str
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
+ Retry-After header is present.
+ """
+
+ def __init__(
+ self,
+ credential: "AsyncTokenCredential",
+ subscription_id: str,
+ base_url: str = "https://management.azure.com",
+ **kwargs: Any
+ ) -> None:
+ self._config = SourceControlConfigurationClientConfiguration(
+ credential=credential, subscription_id=subscription_id, **kwargs
+ )
+ _policies = kwargs.pop("policies", None)
+ if _policies is None:
+ _policies = [
+ policies.RequestIdPolicy(**kwargs),
+ self._config.headers_policy,
+ self._config.user_agent_policy,
+ self._config.proxy_policy,
+ policies.ContentDecodePolicy(**kwargs),
+ AsyncARMAutoResourceProviderRegistrationPolicy(),
+ self._config.redirect_policy,
+ self._config.retry_policy,
+ self._config.authentication_policy,
+ self._config.custom_hook_policy,
+ self._config.logging_policy,
+ policies.DistributedTracingPolicy(**kwargs),
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
+ self._config.http_logging_policy,
+ ]
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
+
+ client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
+ self._serialize = Serializer(client_models)
+ self._deserialize = Deserializer(client_models)
+ self._serialize.client_side_validation = False
+ self.flux_configurations = FluxConfigurationsOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2024-04-01-preview"
+ )
+ self.flux_config_operation_status = FluxConfigOperationStatusOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2024-04-01-preview"
+ )
+
+ def _send_request(
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
+ ) -> Awaitable[AsyncHttpResponse]:
+ """Runs the network request through the client's chained policies.
+
+ >>> from azure.core.rest import HttpRequest
+ >>> 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, stream=stream, **kwargs) # type: ignore
+
+ async def close(self) -> None:
+ await self._client.close()
+
+ async def __aenter__(self) -> Self:
+ await self._client.__aenter__()
+ return self
+
+ async def __aexit__(self, *exc_details: Any) -> None:
+ await self._client.__aexit__(*exc_details)
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/__init__.py
new file mode 100644
index 0000000000000..8e0f5c0793112
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/__init__.py
@@ -0,0 +1,27 @@
+# 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.
+# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+
+from ._patch import __all__ as _patch_all
+from ._patch import *
+from ._patch import patch_sdk as _patch_sdk
+
+__all__ = [
+ "FluxConfigurationsOperations",
+ "FluxConfigOperationStatusOperations",
+]
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
+_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_flux_config_operation_status_operations.py
new file mode 100644
index 0000000000000..0deaa06e3d368
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_flux_config_operation_status_operations.py
@@ -0,0 +1,135 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import sys
+from typing import Any, Callable, Dict, Optional, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from ... import models as _models
+from ...operations._flux_config_operation_status_operations import build_get_request
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class FluxConfigOperationStatusOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.aio.SourceControlConfigurationClient`'s
+ :attr:`flux_config_operation_status` 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")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> _models.OperationStatusResult:
+ """Get Async Operation status.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param operation_id: operation Id. Required.
+ :type operation_id: str
+ :return: OperationStatusResult or the result of cls(response)
+ :rtype: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OperationStatusResult
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_flux_configurations_operations.py
new file mode 100644
index 0000000000000..a8adcfe80817f
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_flux_configurations_operations.py
@@ -0,0 +1,891 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
+from azure.core.rest import AsyncHttpResponse, HttpRequest
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.tracing.decorator_async import distributed_trace_async
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
+
+from ... import models as _models
+from ...operations._flux_configurations_operations import (
+ build_create_or_update_request,
+ build_delete_request,
+ build_get_request,
+ build_list_request,
+ build_update_request,
+)
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+
+class FluxConfigurationsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.aio.SourceControlConfigurationClient`'s
+ :attr:`flux_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")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
+
+ @distributed_trace_async
+ async def get(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ **kwargs: Any
+ ) -> _models.FluxConfiguration:
+ """Gets details of the Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :return: FluxConfiguration or the result of cls(response)
+ :rtype: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ async def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(flux_configuration, (IOBase, bytes)):
+ _content = flux_configuration
+ else:
+ _json = self._serialize.body(flux_configuration, "FluxConfiguration")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: _models.FluxConfiguration,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
+ """Create a new Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
+ :type flux_configuration:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
+ """Create a new Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
+ :type flux_configuration: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
+ """Create a new Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
+ FluxConfiguration type or a IO[bytes] type. Required.
+ :type flux_configuration:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration or IO[bytes]
+ :return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ flux_configuration=flux_configuration,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod,
+ AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs),
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ async def _update_initial(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(flux_configuration_patch, (IOBase, bytes)):
+ _content = flux_configuration_patch
+ else:
+ _json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: _models.FluxConfigurationPatch,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
+ """Update an existing Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
+ Required.
+ :type flux_configuration_patch:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfigurationPatch
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
+ """Update an existing Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
+ Required.
+ :type flux_configuration_patch: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace_async
+ async def begin_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
+ **kwargs: Any
+ ) -> AsyncLROPoller[_models.FluxConfiguration]:
+ # pylint: disable=line-too-long
+ """Update an existing Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
+ :type flux_configuration_patch:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfigurationPatch or
+ IO[bytes]
+ :return: An instance of AsyncLROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._update_initial(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ flux_configuration_patch=flux_configuration_patch,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod,
+ AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs),
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[_models.FluxConfiguration].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ async def _delete_initial(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ force_delete: Optional[bool] = None,
+ **kwargs: Any
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ force_delete=force_delete,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace_async
+ async def begin_delete(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ force_delete: Optional[bool] = None,
+ **kwargs: Any
+ ) -> AsyncLROPoller[None]:
+ """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync
+ from the source repo.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param force_delete: Delete the extension resource in Azure - not the normal asynchronous
+ delete. Default value is None.
+ :type force_delete: bool
+ :return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
+ :rtype: ~azure.core.polling.AsyncLROPoller[None]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = await self._delete_initial(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ force_delete=force_delete,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ await raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: AsyncPollingMethod = cast(
+ AsyncPollingMethod,
+ AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs),
+ )
+ elif polling is False:
+ polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return AsyncLROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ @distributed_trace
+ def list(
+ self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
+ ) -> AsyncIterable["_models.FluxConfiguration"]:
+ # pylint: disable=line-too-long
+ """List all Flux Configurations.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :return: An iterator like instance of either FluxConfiguration or the result of cls(response)
+ :rtype:
+ ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ return pipeline_response
+
+ return AsyncItemPaged(get_next, extract_data)
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/aio/operations/_patch.py
new file mode 100644
index 0000000000000..f7dd32510333d
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/__init__.py
new file mode 100644
index 0000000000000..56c227e38105c
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/__init__.py
@@ -0,0 +1,128 @@
+# 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.
+# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AzureBlobDefinition,
+ AzureBlobPatchDefinition,
+ BucketDefinition,
+ BucketPatchDefinition,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ FluxConfiguration,
+ FluxConfigurationPatch,
+ FluxConfigurationsList,
+ GitRepositoryDefinition,
+ GitRepositoryPatchDefinition,
+ HelmReleasePropertiesDefinition,
+ KustomizationDefinition,
+ KustomizationPatchDefinition,
+ LayerSelectorDefinition,
+ LayerSelectorPatchDefinition,
+ ManagedIdentityDefinition,
+ ManagedIdentityPatchDefinition,
+ MatchOidcIdentityDefinition,
+ MatchOidcIdentityPatchDefinition,
+ OCIRepositoryDefinition,
+ OCIRepositoryPatchDefinition,
+ OCIRepositoryRefDefinition,
+ OCIRepositoryRefPatchDefinition,
+ ObjectReferenceDefinition,
+ ObjectStatusConditionDefinition,
+ ObjectStatusDefinition,
+ OperationStatusResult,
+ PostBuildDefinition,
+ PostBuildPatchDefinition,
+ ProxyResource,
+ RepositoryRefDefinition,
+ Resource,
+ ServicePrincipalDefinition,
+ ServicePrincipalPatchDefinition,
+ SubstituteFromDefinition,
+ SubstituteFromPatchDefinition,
+ SystemData,
+ TlsConfigDefinition,
+ TlsConfigPatchDefinition,
+ VerifyDefinition,
+ VerifyPatchDefinition,
+)
+
+from ._source_control_configuration_client_enums import ( # type: ignore
+ CreatedByType,
+ FluxComplianceState,
+ KustomizationValidationType,
+ OperationType,
+ ProvisioningState,
+ ScopeType,
+ SourceKindType,
+)
+from ._patch import __all__ as _patch_all
+from ._patch import *
+from ._patch import patch_sdk as _patch_sdk
+
+__all__ = [
+ "AzureBlobDefinition",
+ "AzureBlobPatchDefinition",
+ "BucketDefinition",
+ "BucketPatchDefinition",
+ "ErrorAdditionalInfo",
+ "ErrorDetail",
+ "ErrorResponse",
+ "FluxConfiguration",
+ "FluxConfigurationPatch",
+ "FluxConfigurationsList",
+ "GitRepositoryDefinition",
+ "GitRepositoryPatchDefinition",
+ "HelmReleasePropertiesDefinition",
+ "KustomizationDefinition",
+ "KustomizationPatchDefinition",
+ "LayerSelectorDefinition",
+ "LayerSelectorPatchDefinition",
+ "ManagedIdentityDefinition",
+ "ManagedIdentityPatchDefinition",
+ "MatchOidcIdentityDefinition",
+ "MatchOidcIdentityPatchDefinition",
+ "OCIRepositoryDefinition",
+ "OCIRepositoryPatchDefinition",
+ "OCIRepositoryRefDefinition",
+ "OCIRepositoryRefPatchDefinition",
+ "ObjectReferenceDefinition",
+ "ObjectStatusConditionDefinition",
+ "ObjectStatusDefinition",
+ "OperationStatusResult",
+ "PostBuildDefinition",
+ "PostBuildPatchDefinition",
+ "ProxyResource",
+ "RepositoryRefDefinition",
+ "Resource",
+ "ServicePrincipalDefinition",
+ "ServicePrincipalPatchDefinition",
+ "SubstituteFromDefinition",
+ "SubstituteFromPatchDefinition",
+ "SystemData",
+ "TlsConfigDefinition",
+ "TlsConfigPatchDefinition",
+ "VerifyDefinition",
+ "VerifyPatchDefinition",
+ "CreatedByType",
+ "FluxComplianceState",
+ "KustomizationValidationType",
+ "OperationType",
+ "ProvisioningState",
+ "ScopeType",
+ "SourceKindType",
+]
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
+_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_models_py3.py
new file mode 100644
index 0000000000000..365cbce28d078
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_models_py3.py
@@ -0,0 +1,2530 @@
+# 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.
+# --------------------------------------------------------------------------
+
+import datetime
+from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
+
+from ... import _serialization
+
+if TYPE_CHECKING:
+ from .. import models as _models
+
+
+class AzureBlobDefinition(_serialization.Model):
+ """Parameters to reconcile to the AzureBlob source kind type.
+
+ :ivar url: The URL to sync for the flux configuration Azure Blob storage account.
+ :vartype url: str
+ :ivar container_name: The Azure Blob container name to sync from the url endpoint for the flux
+ configuration.
+ :vartype container_name: str
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob
+ source with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob
+ source with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar service_principal: Parameters to authenticate using Service Principal.
+ :vartype service_principal:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ServicePrincipalDefinition
+ :ivar account_key: The account key (shared key) to access the storage account.
+ :vartype account_key: str
+ :ivar sas_token: The Shared Access token to access the storage container.
+ :vartype sas_token: str
+ :ivar managed_identity: Parameters to authenticate using a Managed Identity.
+ :vartype managed_identity:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ManagedIdentityDefinition
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "container_name": {"key": "containerName", "type": "str"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "service_principal": {"key": "servicePrincipal", "type": "ServicePrincipalDefinition"},
+ "account_key": {"key": "accountKey", "type": "str"},
+ "sas_token": {"key": "sasToken", "type": "str"},
+ "managed_identity": {"key": "managedIdentity", "type": "ManagedIdentityDefinition"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ container_name: Optional[str] = None,
+ timeout_in_seconds: int = 600,
+ sync_interval_in_seconds: int = 600,
+ service_principal: Optional["_models.ServicePrincipalDefinition"] = None,
+ account_key: Optional[str] = None,
+ sas_token: Optional[str] = None,
+ managed_identity: Optional["_models.ManagedIdentityDefinition"] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration Azure Blob storage account.
+ :paramtype url: str
+ :keyword container_name: The Azure Blob container name to sync from the url endpoint for the
+ flux configuration.
+ :paramtype container_name: str
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob
+ source with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob
+ source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword service_principal: Parameters to authenticate using Service Principal.
+ :paramtype service_principal:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ServicePrincipalDefinition
+ :keyword account_key: The account key (shared key) to access the storage account.
+ :paramtype account_key: str
+ :keyword sas_token: The Shared Access token to access the storage container.
+ :paramtype sas_token: str
+ :keyword managed_identity: Parameters to authenticate using a Managed Identity.
+ :paramtype managed_identity:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ManagedIdentityDefinition
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.container_name = container_name
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.service_principal = service_principal
+ self.account_key = account_key
+ self.sas_token = sas_token
+ self.managed_identity = managed_identity
+ self.local_auth_ref = local_auth_ref
+
+
+class AzureBlobPatchDefinition(_serialization.Model):
+ """Parameters to reconcile to the AzureBlob source kind type.
+
+ :ivar url: The URL to sync for the flux configuration Azure Blob storage account.
+ :vartype url: str
+ :ivar container_name: The Azure Blob container name to sync from the url endpoint for the flux
+ configuration.
+ :vartype container_name: str
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob
+ source with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob
+ source with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar service_principal: Parameters to authenticate using Service Principal.
+ :vartype service_principal:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ServicePrincipalPatchDefinition
+ :ivar account_key: The account key (shared key) to access the storage account.
+ :vartype account_key: str
+ :ivar sas_token: The Shared Access token to access the storage container.
+ :vartype sas_token: str
+ :ivar managed_identity: Parameters to authenticate using a Managed Identity.
+ :vartype managed_identity:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ManagedIdentityPatchDefinition
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "container_name": {"key": "containerName", "type": "str"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "service_principal": {"key": "servicePrincipal", "type": "ServicePrincipalPatchDefinition"},
+ "account_key": {"key": "accountKey", "type": "str"},
+ "sas_token": {"key": "sasToken", "type": "str"},
+ "managed_identity": {"key": "managedIdentity", "type": "ManagedIdentityPatchDefinition"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ container_name: Optional[str] = None,
+ timeout_in_seconds: Optional[int] = None,
+ sync_interval_in_seconds: Optional[int] = None,
+ service_principal: Optional["_models.ServicePrincipalPatchDefinition"] = None,
+ account_key: Optional[str] = None,
+ sas_token: Optional[str] = None,
+ managed_identity: Optional["_models.ManagedIdentityPatchDefinition"] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration Azure Blob storage account.
+ :paramtype url: str
+ :keyword container_name: The Azure Blob container name to sync from the url endpoint for the
+ flux configuration.
+ :paramtype container_name: str
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster Azure Blob
+ source with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster Azure Blob
+ source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword service_principal: Parameters to authenticate using Service Principal.
+ :paramtype service_principal:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ServicePrincipalPatchDefinition
+ :keyword account_key: The account key (shared key) to access the storage account.
+ :paramtype account_key: str
+ :keyword sas_token: The Shared Access token to access the storage container.
+ :paramtype sas_token: str
+ :keyword managed_identity: Parameters to authenticate using a Managed Identity.
+ :paramtype managed_identity:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ManagedIdentityPatchDefinition
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.container_name = container_name
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.service_principal = service_principal
+ self.account_key = account_key
+ self.sas_token = sas_token
+ self.managed_identity = managed_identity
+ self.local_auth_ref = local_auth_ref
+
+
+class BucketDefinition(_serialization.Model):
+ """Parameters to reconcile to the Bucket source kind type.
+
+ :ivar url: The URL to sync for the flux configuration S3 bucket.
+ :vartype url: str
+ :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration.
+ :vartype bucket_name: str
+ :ivar insecure: Specify whether to use insecure communication when puling data from the S3
+ bucket.
+ :vartype insecure: bool
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source
+ with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket source
+ with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar access_key: Plaintext access key used to securely access the S3 bucket.
+ :vartype access_key: str
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "bucket_name": {"key": "bucketName", "type": "str"},
+ "insecure": {"key": "insecure", "type": "bool"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "access_key": {"key": "accessKey", "type": "str"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ bucket_name: Optional[str] = None,
+ insecure: bool = True,
+ timeout_in_seconds: int = 600,
+ sync_interval_in_seconds: int = 600,
+ access_key: Optional[str] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration S3 bucket.
+ :paramtype url: str
+ :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration.
+ :paramtype bucket_name: str
+ :keyword insecure: Specify whether to use insecure communication when puling data from the S3
+ bucket.
+ :paramtype insecure: bool
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source
+ with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket
+ source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword access_key: Plaintext access key used to securely access the S3 bucket.
+ :paramtype access_key: str
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.bucket_name = bucket_name
+ self.insecure = insecure
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.access_key = access_key
+ self.local_auth_ref = local_auth_ref
+
+
+class BucketPatchDefinition(_serialization.Model):
+ """Parameters to reconcile to the Bucket source kind type.
+
+ :ivar url: The URL to sync for the flux configuration S3 bucket.
+ :vartype url: str
+ :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration.
+ :vartype bucket_name: str
+ :ivar insecure: Specify whether to use insecure communication when puling data from the S3
+ bucket.
+ :vartype insecure: bool
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source
+ with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket source
+ with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar access_key: Plaintext access key used to securely access the S3 bucket.
+ :vartype access_key: str
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "bucket_name": {"key": "bucketName", "type": "str"},
+ "insecure": {"key": "insecure", "type": "bool"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "access_key": {"key": "accessKey", "type": "str"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ bucket_name: Optional[str] = None,
+ insecure: Optional[bool] = None,
+ timeout_in_seconds: Optional[int] = None,
+ sync_interval_in_seconds: Optional[int] = None,
+ access_key: Optional[str] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration S3 bucket.
+ :paramtype url: str
+ :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration.
+ :paramtype bucket_name: str
+ :keyword insecure: Specify whether to use insecure communication when puling data from the S3
+ bucket.
+ :paramtype insecure: bool
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster bucket source
+ with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster bucket
+ source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword access_key: Plaintext access key used to securely access the S3 bucket.
+ :paramtype access_key: str
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.bucket_name = bucket_name
+ self.insecure = insecure
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.access_key = access_key
+ self.local_auth_ref = local_auth_ref
+
+
+class ErrorAdditionalInfo(_serialization.Model):
+ """The resource management error additional info.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar type: The additional info type.
+ :vartype type: str
+ :ivar info: The additional info.
+ :vartype info: JSON
+ """
+
+ _validation = {
+ "type": {"readonly": True},
+ "info": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "type": {"key": "type", "type": "str"},
+ "info": {"key": "info", "type": "object"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.type = None
+ self.info = None
+
+
+class ErrorDetail(_serialization.Model):
+ """The error detail.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar code: The error code.
+ :vartype code: str
+ :ivar message: The error message.
+ :vartype message: str
+ :ivar target: The error target.
+ :vartype target: str
+ :ivar details: The error details.
+ :vartype details:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ErrorDetail]
+ :ivar additional_info: The error additional info.
+ :vartype additional_info:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_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: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.code = None
+ self.message = None
+ self.target = None
+ self.details = None
+ self.additional_info = None
+
+
+class ErrorResponse(_serialization.Model):
+ """Common error response for all Azure Resource Manager APIs to return error details for failed
+ operations. (This also follows the OData error response format.).
+
+ :ivar error: The error object.
+ :vartype error: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ErrorDetail
+ """
+
+ _attribute_map = {
+ "error": {"key": "error", "type": "ErrorDetail"},
+ }
+
+ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None:
+ """
+ :keyword error: The error object.
+ :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ErrorDetail
+ """
+ super().__init__(**kwargs)
+ self.error = error
+
+
+class Resource(_serialization.Model):
+ """Common fields that are returned in the response for all Azure Resource Manager resources.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Fully qualified resource ID for the resource. Ex -
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
+ :vartype id: str
+ :ivar name: The name of the resource.
+ :vartype name: str
+ :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
+ "Microsoft.Storage/storageAccounts".
+ :vartype type: str
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.id = None
+ self.name = None
+ self.type = None
+
+
+class ProxyResource(Resource):
+ """The resource model definition for a Azure Resource Manager proxy resource. It will not have
+ tags and a location.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Fully qualified resource ID for the resource. Ex -
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
+ :vartype id: str
+ :ivar name: The name of the resource.
+ :vartype name: str
+ :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
+ "Microsoft.Storage/storageAccounts".
+ :vartype type: str
+ """
+
+
+class FluxConfiguration(ProxyResource):
+ """The Flux Configuration object returned in Get & Put response.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar id: Fully qualified resource ID for the resource. Ex -
+ /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long
+ :vartype id: str
+ :ivar name: The name of the resource.
+ :vartype name: str
+ :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
+ "Microsoft.Storage/storageAccounts".
+ :vartype type: str
+ :ivar system_data: Top level metadata
+ https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. # pylint: disable=line-too-long
+ :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SystemData
+ :ivar scope: Scope at which the operator will be installed. Known values are: "cluster" and
+ "namespace".
+ :vartype scope: str or ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ScopeType
+ :ivar namespace: The namespace to which this configuration is installed to. Maximum of 253
+ lower case alphanumeric characters, hyphen and period only.
+ :vartype namespace: str
+ :ivar source_kind: Source Kind to pull the configuration data from. Known values are:
+ "GitRepository", "Bucket", "AzureBlob", and "OCIRepository".
+ :vartype source_kind: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SourceKindType
+ :ivar suspend: Whether this configuration should suspend its reconciliation of its
+ kustomizations and sources.
+ :vartype suspend: bool
+ :ivar git_repository: Parameters to reconcile to the GitRepository source kind type.
+ :vartype git_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.GitRepositoryDefinition
+ :ivar bucket: Parameters to reconcile to the Bucket source kind type.
+ :vartype bucket:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.BucketDefinition
+ :ivar azure_blob: Parameters to reconcile to the AzureBlob source kind type.
+ :vartype azure_blob:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.AzureBlobDefinition
+ :ivar oci_repository: Parameters to reconcile to the OCIRepository source kind type.
+ :vartype oci_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryDefinition
+ :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the
+ source type on the cluster.
+ :vartype kustomizations: dict[str,
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.KustomizationDefinition]
+ :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for
+ the configuration.
+ :vartype configuration_protected_settings: dict[str, str]
+ :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or
+ created by the managed objects provisioned by the fluxConfiguration.
+ :vartype statuses:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ObjectStatusDefinition]
+ :ivar repository_public_key: Public Key associated with this fluxConfiguration (either
+ generated within the cluster or provided by the user).
+ :vartype repository_public_key: str
+ :ivar source_synced_commit_id: Branch and/or SHA of the source commit synced with the cluster.
+ :vartype source_synced_commit_id: str
+ :ivar source_updated_at: Datetime the fluxConfiguration synced its source on the cluster.
+ :vartype source_updated_at: ~datetime.datetime
+ :ivar status_updated_at: Datetime the fluxConfiguration synced its status on the cluster with
+ Azure.
+ :vartype status_updated_at: ~datetime.datetime
+ :ivar wait_for_reconciliation: Whether flux configuration deployment should wait for cluster to
+ reconcile the kustomizations.
+ :vartype wait_for_reconciliation: bool
+ :ivar reconciliation_wait_duration: Maximum duration to wait for flux configuration
+ reconciliation. E.g PT1H, PT5M, P1D.
+ :vartype reconciliation_wait_duration: str
+ :ivar compliance_state: Combined status of the Flux Kubernetes resources created by the
+ fluxConfiguration or created by the managed objects. Known values are: "Compliant",
+ "Non-Compliant", "Pending", "Suspended", and "Unknown".
+ :vartype compliance_state: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxComplianceState
+ :ivar provisioning_state: Status of the creation of the fluxConfiguration. Known values are:
+ "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting".
+ :vartype provisioning_state: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ProvisioningState
+ :ivar error_message: Error message returned to the user in the case of provisioning failure.
+ :vartype error_message: str
+ """
+
+ _validation = {
+ "id": {"readonly": True},
+ "name": {"readonly": True},
+ "type": {"readonly": True},
+ "system_data": {"readonly": True},
+ "statuses": {"readonly": True},
+ "repository_public_key": {"readonly": True},
+ "source_synced_commit_id": {"readonly": True},
+ "source_updated_at": {"readonly": True},
+ "status_updated_at": {"readonly": True},
+ "compliance_state": {"readonly": True},
+ "provisioning_state": {"readonly": True},
+ "error_message": {"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"},
+ "scope": {"key": "properties.scope", "type": "str"},
+ "namespace": {"key": "properties.namespace", "type": "str"},
+ "source_kind": {"key": "properties.sourceKind", "type": "str"},
+ "suspend": {"key": "properties.suspend", "type": "bool"},
+ "git_repository": {"key": "properties.gitRepository", "type": "GitRepositoryDefinition"},
+ "bucket": {"key": "properties.bucket", "type": "BucketDefinition"},
+ "azure_blob": {"key": "properties.azureBlob", "type": "AzureBlobDefinition"},
+ "oci_repository": {"key": "properties.ociRepository", "type": "OCIRepositoryDefinition"},
+ "kustomizations": {"key": "properties.kustomizations", "type": "{KustomizationDefinition}"},
+ "configuration_protected_settings": {"key": "properties.configurationProtectedSettings", "type": "{str}"},
+ "statuses": {"key": "properties.statuses", "type": "[ObjectStatusDefinition]"},
+ "repository_public_key": {"key": "properties.repositoryPublicKey", "type": "str"},
+ "source_synced_commit_id": {"key": "properties.sourceSyncedCommitId", "type": "str"},
+ "source_updated_at": {"key": "properties.sourceUpdatedAt", "type": "iso-8601"},
+ "status_updated_at": {"key": "properties.statusUpdatedAt", "type": "iso-8601"},
+ "wait_for_reconciliation": {"key": "properties.waitForReconciliation", "type": "bool"},
+ "reconciliation_wait_duration": {"key": "properties.reconciliationWaitDuration", "type": "str"},
+ "compliance_state": {"key": "properties.complianceState", "type": "str"},
+ "provisioning_state": {"key": "properties.provisioningState", "type": "str"},
+ "error_message": {"key": "properties.errorMessage", "type": "str"},
+ }
+
+ def __init__( # pylint: disable=too-many-locals
+ self,
+ *,
+ scope: Union[str, "_models.ScopeType"] = "cluster",
+ namespace: str = "default",
+ source_kind: Optional[Union[str, "_models.SourceKindType"]] = None,
+ suspend: bool = False,
+ git_repository: Optional["_models.GitRepositoryDefinition"] = None,
+ bucket: Optional["_models.BucketDefinition"] = None,
+ azure_blob: Optional["_models.AzureBlobDefinition"] = None,
+ oci_repository: Optional["_models.OCIRepositoryDefinition"] = None,
+ kustomizations: Optional[Dict[str, "_models.KustomizationDefinition"]] = None,
+ configuration_protected_settings: Optional[Dict[str, str]] = None,
+ wait_for_reconciliation: Optional[bool] = None,
+ reconciliation_wait_duration: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword scope: Scope at which the operator will be installed. Known values are: "cluster" and
+ "namespace".
+ :paramtype scope: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ScopeType
+ :keyword namespace: The namespace to which this configuration is installed to. Maximum of 253
+ lower case alphanumeric characters, hyphen and period only.
+ :paramtype namespace: str
+ :keyword source_kind: Source Kind to pull the configuration data from. Known values are:
+ "GitRepository", "Bucket", "AzureBlob", and "OCIRepository".
+ :paramtype source_kind: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SourceKindType
+ :keyword suspend: Whether this configuration should suspend its reconciliation of its
+ kustomizations and sources.
+ :paramtype suspend: bool
+ :keyword git_repository: Parameters to reconcile to the GitRepository source kind type.
+ :paramtype git_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.GitRepositoryDefinition
+ :keyword bucket: Parameters to reconcile to the Bucket source kind type.
+ :paramtype bucket:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.BucketDefinition
+ :keyword azure_blob: Parameters to reconcile to the AzureBlob source kind type.
+ :paramtype azure_blob:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.AzureBlobDefinition
+ :keyword oci_repository: Parameters to reconcile to the OCIRepository source kind type.
+ :paramtype oci_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryDefinition
+ :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the
+ source type on the cluster.
+ :paramtype kustomizations: dict[str,
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.KustomizationDefinition]
+ :keyword configuration_protected_settings: Key-value pairs of protected configuration settings
+ for the configuration.
+ :paramtype configuration_protected_settings: dict[str, str]
+ :keyword wait_for_reconciliation: Whether flux configuration deployment should wait for cluster
+ to reconcile the kustomizations.
+ :paramtype wait_for_reconciliation: bool
+ :keyword reconciliation_wait_duration: Maximum duration to wait for flux configuration
+ reconciliation. E.g PT1H, PT5M, P1D.
+ :paramtype reconciliation_wait_duration: str
+ """
+ super().__init__(**kwargs)
+ self.system_data = None
+ self.scope = scope
+ self.namespace = namespace
+ self.source_kind = source_kind
+ self.suspend = suspend
+ self.git_repository = git_repository
+ self.bucket = bucket
+ self.azure_blob = azure_blob
+ self.oci_repository = oci_repository
+ self.kustomizations = kustomizations
+ self.configuration_protected_settings = configuration_protected_settings
+ self.statuses = None
+ self.repository_public_key = None
+ self.source_synced_commit_id = None
+ self.source_updated_at = None
+ self.status_updated_at = None
+ self.wait_for_reconciliation = wait_for_reconciliation
+ self.reconciliation_wait_duration = reconciliation_wait_duration
+ self.compliance_state = None
+ self.provisioning_state = None
+ self.error_message = None
+
+
+class FluxConfigurationPatch(_serialization.Model):
+ """The Flux Configuration Patch Request object.
+
+ :ivar source_kind: Source Kind to pull the configuration data from. Known values are:
+ "GitRepository", "Bucket", "AzureBlob", and "OCIRepository".
+ :vartype source_kind: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SourceKindType
+ :ivar suspend: Whether this configuration should suspend its reconciliation of its
+ kustomizations and sources.
+ :vartype suspend: bool
+ :ivar git_repository: Parameters to reconcile to the GitRepository source kind type.
+ :vartype git_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.GitRepositoryPatchDefinition
+ :ivar bucket: Parameters to reconcile to the Bucket source kind type.
+ :vartype bucket:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.BucketPatchDefinition
+ :ivar azure_blob: Parameters to reconcile to the AzureBlob source kind type.
+ :vartype azure_blob:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.AzureBlobPatchDefinition
+ :ivar oci_repository: Parameters to reconcile to the OCIRepository source kind type.
+ :vartype oci_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryPatchDefinition
+ :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the
+ source type on the cluster.
+ :vartype kustomizations: dict[str,
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.KustomizationPatchDefinition]
+ :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for
+ the configuration.
+ :vartype configuration_protected_settings: dict[str, str]
+ """
+
+ _attribute_map = {
+ "source_kind": {"key": "properties.sourceKind", "type": "str"},
+ "suspend": {"key": "properties.suspend", "type": "bool"},
+ "git_repository": {"key": "properties.gitRepository", "type": "GitRepositoryPatchDefinition"},
+ "bucket": {"key": "properties.bucket", "type": "BucketPatchDefinition"},
+ "azure_blob": {"key": "properties.azureBlob", "type": "AzureBlobPatchDefinition"},
+ "oci_repository": {"key": "properties.ociRepository", "type": "OCIRepositoryPatchDefinition"},
+ "kustomizations": {"key": "properties.kustomizations", "type": "{KustomizationPatchDefinition}"},
+ "configuration_protected_settings": {"key": "properties.configurationProtectedSettings", "type": "{str}"},
+ }
+
+ def __init__(
+ self,
+ *,
+ source_kind: Optional[Union[str, "_models.SourceKindType"]] = None,
+ suspend: Optional[bool] = None,
+ git_repository: Optional["_models.GitRepositoryPatchDefinition"] = None,
+ bucket: Optional["_models.BucketPatchDefinition"] = None,
+ azure_blob: Optional["_models.AzureBlobPatchDefinition"] = None,
+ oci_repository: Optional["_models.OCIRepositoryPatchDefinition"] = None,
+ kustomizations: Optional[Dict[str, "_models.KustomizationPatchDefinition"]] = None,
+ configuration_protected_settings: Optional[Dict[str, str]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword source_kind: Source Kind to pull the configuration data from. Known values are:
+ "GitRepository", "Bucket", "AzureBlob", and "OCIRepository".
+ :paramtype source_kind: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SourceKindType
+ :keyword suspend: Whether this configuration should suspend its reconciliation of its
+ kustomizations and sources.
+ :paramtype suspend: bool
+ :keyword git_repository: Parameters to reconcile to the GitRepository source kind type.
+ :paramtype git_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.GitRepositoryPatchDefinition
+ :keyword bucket: Parameters to reconcile to the Bucket source kind type.
+ :paramtype bucket:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.BucketPatchDefinition
+ :keyword azure_blob: Parameters to reconcile to the AzureBlob source kind type.
+ :paramtype azure_blob:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.AzureBlobPatchDefinition
+ :keyword oci_repository: Parameters to reconcile to the OCIRepository source kind type.
+ :paramtype oci_repository:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryPatchDefinition
+ :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the
+ source type on the cluster.
+ :paramtype kustomizations: dict[str,
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.KustomizationPatchDefinition]
+ :keyword configuration_protected_settings: Key-value pairs of protected configuration settings
+ for the configuration.
+ :paramtype configuration_protected_settings: dict[str, str]
+ """
+ super().__init__(**kwargs)
+ self.source_kind = source_kind
+ self.suspend = suspend
+ self.git_repository = git_repository
+ self.bucket = bucket
+ self.azure_blob = azure_blob
+ self.oci_repository = oci_repository
+ self.kustomizations = kustomizations
+ self.configuration_protected_settings = configuration_protected_settings
+
+
+class FluxConfigurationsList(_serialization.Model):
+ """Result of the request to list Flux Configurations. It contains a list of FluxConfiguration
+ objects and a URL link to get the next set of results.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar value: List of Flux Configurations within a Kubernetes cluster.
+ :vartype value:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :ivar next_link: URL to get the next set of configuration objects, if any.
+ :vartype next_link: str
+ """
+
+ _validation = {
+ "value": {"readonly": True},
+ "next_link": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "value": {"key": "value", "type": "[FluxConfiguration]"},
+ "next_link": {"key": "nextLink", "type": "str"},
+ }
+
+ def __init__(self, **kwargs: Any) -> None:
+ """ """
+ super().__init__(**kwargs)
+ self.value = None
+ self.next_link = None
+
+
+class GitRepositoryDefinition(_serialization.Model):
+ """Parameters to reconcile to the GitRepository source kind type.
+
+ :ivar url: The URL to sync for the flux configuration git repository.
+ :vartype url: str
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository
+ source with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git
+ repository source with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar repository_ref: The source reference for the GitRepository object.
+ :vartype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.RepositoryRefDefinition
+ :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to
+ access private git repositories over SSH.
+ :vartype ssh_known_hosts: str
+ :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS.
+ :vartype https_user: str
+ :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git
+ private git repositories over HTTPS.
+ :vartype https_ca_cert: str
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "repository_ref": {"key": "repositoryRef", "type": "RepositoryRefDefinition"},
+ "ssh_known_hosts": {"key": "sshKnownHosts", "type": "str"},
+ "https_user": {"key": "httpsUser", "type": "str"},
+ "https_ca_cert": {"key": "httpsCACert", "type": "str"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ timeout_in_seconds: int = 600,
+ sync_interval_in_seconds: int = 600,
+ repository_ref: Optional["_models.RepositoryRefDefinition"] = None,
+ ssh_known_hosts: Optional[str] = None,
+ https_user: Optional[str] = None,
+ https_ca_cert: Optional[str] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration git repository.
+ :paramtype url: str
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git
+ repository source with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git
+ repository source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword repository_ref: The source reference for the GitRepository object.
+ :paramtype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.RepositoryRefDefinition
+ :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required
+ to access private git repositories over SSH.
+ :paramtype ssh_known_hosts: str
+ :keyword https_user: Plaintext HTTPS username used to access private git repositories over
+ HTTPS.
+ :paramtype https_user: str
+ :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git
+ private git repositories over HTTPS.
+ :paramtype https_ca_cert: str
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.repository_ref = repository_ref
+ self.ssh_known_hosts = ssh_known_hosts
+ self.https_user = https_user
+ self.https_ca_cert = https_ca_cert
+ self.local_auth_ref = local_auth_ref
+
+
+class GitRepositoryPatchDefinition(_serialization.Model):
+ """Parameters to reconcile to the GitRepository source kind type.
+
+ :ivar url: The URL to sync for the flux configuration git repository.
+ :vartype url: str
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository
+ source with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git
+ repository source with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar repository_ref: The source reference for the GitRepository object.
+ :vartype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.RepositoryRefDefinition
+ :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to
+ access private git repositories over SSH.
+ :vartype ssh_known_hosts: str
+ :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS.
+ :vartype https_user: str
+ :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git
+ private git repositories over HTTPS.
+ :vartype https_ca_cert: str
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "repository_ref": {"key": "repositoryRef", "type": "RepositoryRefDefinition"},
+ "ssh_known_hosts": {"key": "sshKnownHosts", "type": "str"},
+ "https_user": {"key": "httpsUser", "type": "str"},
+ "https_ca_cert": {"key": "httpsCACert", "type": "str"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ timeout_in_seconds: Optional[int] = None,
+ sync_interval_in_seconds: Optional[int] = None,
+ repository_ref: Optional["_models.RepositoryRefDefinition"] = None,
+ ssh_known_hosts: Optional[str] = None,
+ https_user: Optional[str] = None,
+ https_ca_cert: Optional[str] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration git repository.
+ :paramtype url: str
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git
+ repository source with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git
+ repository source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword repository_ref: The source reference for the GitRepository object.
+ :paramtype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.RepositoryRefDefinition
+ :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required
+ to access private git repositories over SSH.
+ :paramtype ssh_known_hosts: str
+ :keyword https_user: Plaintext HTTPS username used to access private git repositories over
+ HTTPS.
+ :paramtype https_user: str
+ :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git
+ private git repositories over HTTPS.
+ :paramtype https_ca_cert: str
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.repository_ref = repository_ref
+ self.ssh_known_hosts = ssh_known_hosts
+ self.https_user = https_user
+ self.https_ca_cert = https_ca_cert
+ self.local_auth_ref = local_auth_ref
+
+
+class HelmReleasePropertiesDefinition(_serialization.Model):
+ """Properties for HelmRelease objects.
+
+ :ivar last_revision_applied: The revision number of the last released object change.
+ :vartype last_revision_applied: int
+ :ivar helm_chart_ref: The reference to the HelmChart object used as the source to this
+ HelmRelease.
+ :vartype helm_chart_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ObjectReferenceDefinition
+ :ivar failure_count: Total number of times that the HelmRelease failed to install or upgrade.
+ :vartype failure_count: int
+ :ivar install_failure_count: Number of times that the HelmRelease failed to install.
+ :vartype install_failure_count: int
+ :ivar upgrade_failure_count: Number of times that the HelmRelease failed to upgrade.
+ :vartype upgrade_failure_count: int
+ """
+
+ _attribute_map = {
+ "last_revision_applied": {"key": "lastRevisionApplied", "type": "int"},
+ "helm_chart_ref": {"key": "helmChartRef", "type": "ObjectReferenceDefinition"},
+ "failure_count": {"key": "failureCount", "type": "int"},
+ "install_failure_count": {"key": "installFailureCount", "type": "int"},
+ "upgrade_failure_count": {"key": "upgradeFailureCount", "type": "int"},
+ }
+
+ def __init__(
+ self,
+ *,
+ last_revision_applied: Optional[int] = None,
+ helm_chart_ref: Optional["_models.ObjectReferenceDefinition"] = None,
+ failure_count: Optional[int] = None,
+ install_failure_count: Optional[int] = None,
+ upgrade_failure_count: Optional[int] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword last_revision_applied: The revision number of the last released object change.
+ :paramtype last_revision_applied: int
+ :keyword helm_chart_ref: The reference to the HelmChart object used as the source to this
+ HelmRelease.
+ :paramtype helm_chart_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ObjectReferenceDefinition
+ :keyword failure_count: Total number of times that the HelmRelease failed to install or
+ upgrade.
+ :paramtype failure_count: int
+ :keyword install_failure_count: Number of times that the HelmRelease failed to install.
+ :paramtype install_failure_count: int
+ :keyword upgrade_failure_count: Number of times that the HelmRelease failed to upgrade.
+ :paramtype upgrade_failure_count: int
+ """
+ super().__init__(**kwargs)
+ self.last_revision_applied = last_revision_applied
+ self.helm_chart_ref = helm_chart_ref
+ self.failure_count = failure_count
+ self.install_failure_count = install_failure_count
+ self.upgrade_failure_count = upgrade_failure_count
+
+
+class KustomizationDefinition(_serialization.Model):
+ """The Kustomization defining how to reconcile the artifact pulled by the source type on the
+ cluster.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :ivar name: Name of the Kustomization, matching the key in the Kustomizations object map.
+ :vartype name: str
+ :ivar path: The path in the source reference to reconcile on the cluster.
+ :vartype path: str
+ :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This
+ Kustomization will not reconcile until all dependencies have completed their reconciliation.
+ :vartype depends_on: list[str]
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the
+ cluster.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the
+ cluster.
+ :vartype sync_interval_in_seconds: int
+ :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the
+ cluster in the event of failure on reconciliation.
+ :vartype retry_interval_in_seconds: int
+ :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this
+ Kustomization.
+ :vartype prune: bool
+ :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails
+ due to an immutable field change.
+ :vartype force: bool
+ :ivar wait: Enable/disable health check for all Kubernetes objects created by this
+ Kustomization.
+ :vartype wait: bool
+ :ivar post_build: Used for variable substitution for this Kustomization after kustomize build.
+ :vartype post_build:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.PostBuildDefinition
+ """
+
+ _validation = {
+ "name": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "path": {"key": "path", "type": "str"},
+ "depends_on": {"key": "dependsOn", "type": "[str]"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "retry_interval_in_seconds": {"key": "retryIntervalInSeconds", "type": "int"},
+ "prune": {"key": "prune", "type": "bool"},
+ "force": {"key": "force", "type": "bool"},
+ "wait": {"key": "wait", "type": "bool"},
+ "post_build": {"key": "postBuild", "type": "PostBuildDefinition"},
+ }
+
+ def __init__(
+ self,
+ *,
+ path: str = "",
+ depends_on: Optional[List[str]] = None,
+ timeout_in_seconds: int = 600,
+ sync_interval_in_seconds: int = 600,
+ retry_interval_in_seconds: Optional[int] = None,
+ prune: bool = False,
+ force: bool = False,
+ wait: bool = True,
+ post_build: Optional["_models.PostBuildDefinition"] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword path: The path in the source reference to reconcile on the cluster.
+ :paramtype path: str
+ :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This
+ Kustomization will not reconcile until all dependencies have completed their reconciliation.
+ :paramtype depends_on: list[str]
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the
+ cluster.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on
+ the cluster.
+ :paramtype sync_interval_in_seconds: int
+ :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on
+ the cluster in the event of failure on reconciliation.
+ :paramtype retry_interval_in_seconds: int
+ :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this
+ Kustomization.
+ :paramtype prune: bool
+ :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching
+ fails due to an immutable field change.
+ :paramtype force: bool
+ :keyword wait: Enable/disable health check for all Kubernetes objects created by this
+ Kustomization.
+ :paramtype wait: bool
+ :keyword post_build: Used for variable substitution for this Kustomization after kustomize
+ build.
+ :paramtype post_build:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.PostBuildDefinition
+ """
+ super().__init__(**kwargs)
+ self.name = None
+ self.path = path
+ self.depends_on = depends_on
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.retry_interval_in_seconds = retry_interval_in_seconds
+ self.prune = prune
+ self.force = force
+ self.wait = wait
+ self.post_build = post_build
+
+
+class KustomizationPatchDefinition(_serialization.Model):
+ """The Kustomization defining how to reconcile the artifact pulled by the source type on the
+ cluster.
+
+ :ivar path: The path in the source reference to reconcile on the cluster.
+ :vartype path: str
+ :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This
+ Kustomization will not reconcile until all dependencies have completed their reconciliation.
+ :vartype depends_on: list[str]
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the
+ cluster.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the
+ cluster.
+ :vartype sync_interval_in_seconds: int
+ :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the
+ cluster in the event of failure on reconciliation.
+ :vartype retry_interval_in_seconds: int
+ :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this
+ Kustomization.
+ :vartype prune: bool
+ :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails
+ due to an immutable field change.
+ :vartype force: bool
+ :ivar wait: Enable/disable health check for all Kubernetes objects created by this
+ Kustomization.
+ :vartype wait: bool
+ :ivar post_build: Used for variable substitution for this Kustomization after kustomize build.
+ :vartype post_build:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.PostBuildPatchDefinition
+ """
+
+ _attribute_map = {
+ "path": {"key": "path", "type": "str"},
+ "depends_on": {"key": "dependsOn", "type": "[str]"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "retry_interval_in_seconds": {"key": "retryIntervalInSeconds", "type": "int"},
+ "prune": {"key": "prune", "type": "bool"},
+ "force": {"key": "force", "type": "bool"},
+ "wait": {"key": "wait", "type": "bool"},
+ "post_build": {"key": "postBuild", "type": "PostBuildPatchDefinition"},
+ }
+
+ def __init__(
+ self,
+ *,
+ path: Optional[str] = None,
+ depends_on: Optional[List[str]] = None,
+ timeout_in_seconds: Optional[int] = None,
+ sync_interval_in_seconds: Optional[int] = None,
+ retry_interval_in_seconds: Optional[int] = None,
+ prune: Optional[bool] = None,
+ force: Optional[bool] = None,
+ wait: Optional[bool] = None,
+ post_build: Optional["_models.PostBuildPatchDefinition"] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword path: The path in the source reference to reconcile on the cluster.
+ :paramtype path: str
+ :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This
+ Kustomization will not reconcile until all dependencies have completed their reconciliation.
+ :paramtype depends_on: list[str]
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the
+ cluster.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on
+ the cluster.
+ :paramtype sync_interval_in_seconds: int
+ :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on
+ the cluster in the event of failure on reconciliation.
+ :paramtype retry_interval_in_seconds: int
+ :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this
+ Kustomization.
+ :paramtype prune: bool
+ :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching
+ fails due to an immutable field change.
+ :paramtype force: bool
+ :keyword wait: Enable/disable health check for all Kubernetes objects created by this
+ Kustomization.
+ :paramtype wait: bool
+ :keyword post_build: Used for variable substitution for this Kustomization after kustomize
+ build.
+ :paramtype post_build:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.PostBuildPatchDefinition
+ """
+ super().__init__(**kwargs)
+ self.path = path
+ self.depends_on = depends_on
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.retry_interval_in_seconds = retry_interval_in_seconds
+ self.prune = prune
+ self.force = force
+ self.wait = wait
+ self.post_build = post_build
+
+
+class LayerSelectorDefinition(_serialization.Model):
+ """Parameters to specify which layer to pull from the OCI artifact. By default, the first layer in
+ the artifact is pulled.
+
+ :ivar media_type: The first layer matching the specified media type will be used.
+ :vartype media_type: str
+ :ivar operation: The operation to be performed on the selected layer. The default value is
+ 'extract', but it can be set to 'copy'. Known values are: "extract" and "copy".
+ :vartype operation: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OperationType
+ """
+
+ _attribute_map = {
+ "media_type": {"key": "mediaType", "type": "str"},
+ "operation": {"key": "operation", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ media_type: Optional[str] = None,
+ operation: Optional[Union[str, "_models.OperationType"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword media_type: The first layer matching the specified media type will be used.
+ :paramtype media_type: str
+ :keyword operation: The operation to be performed on the selected layer. The default value is
+ 'extract', but it can be set to 'copy'. Known values are: "extract" and "copy".
+ :paramtype operation: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OperationType
+ """
+ super().__init__(**kwargs)
+ self.media_type = media_type
+ self.operation = operation
+
+
+class LayerSelectorPatchDefinition(_serialization.Model):
+ """Parameters to specify which layer to pull from the OCI artifact. By default, the first layer in
+ the artifact is pulled.
+
+ :ivar media_type: The first layer matching the specified media type will be used.
+ :vartype media_type: str
+ :ivar operation: The operation to be performed on the selected layer. The default value is
+ 'extract', but it can be set to 'copy'. Known values are: "extract" and "copy".
+ :vartype operation: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OperationType
+ """
+
+ _attribute_map = {
+ "media_type": {"key": "mediaType", "type": "str"},
+ "operation": {"key": "operation", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ media_type: Optional[str] = None,
+ operation: Optional[Union[str, "_models.OperationType"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword media_type: The first layer matching the specified media type will be used.
+ :paramtype media_type: str
+ :keyword operation: The operation to be performed on the selected layer. The default value is
+ 'extract', but it can be set to 'copy'. Known values are: "extract" and "copy".
+ :paramtype operation: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OperationType
+ """
+ super().__init__(**kwargs)
+ self.media_type = media_type
+ self.operation = operation
+
+
+class ManagedIdentityDefinition(_serialization.Model):
+ """Parameters to authenticate using a Managed Identity.
+
+ :ivar client_id: The client Id for authenticating a Managed Identity.
+ :vartype client_id: str
+ """
+
+ _attribute_map = {
+ "client_id": {"key": "clientId", "type": "str"},
+ }
+
+ def __init__(self, *, client_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword client_id: The client Id for authenticating a Managed Identity.
+ :paramtype client_id: str
+ """
+ super().__init__(**kwargs)
+ self.client_id = client_id
+
+
+class ManagedIdentityPatchDefinition(_serialization.Model):
+ """Parameters to authenticate using a Managed Identity.
+
+ :ivar client_id: The client Id for authenticating a Managed Identity.
+ :vartype client_id: str
+ """
+
+ _attribute_map = {
+ "client_id": {"key": "clientId", "type": "str"},
+ }
+
+ def __init__(self, *, client_id: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword client_id: The client Id for authenticating a Managed Identity.
+ :paramtype client_id: str
+ """
+ super().__init__(**kwargs)
+ self.client_id = client_id
+
+
+class MatchOidcIdentityDefinition(_serialization.Model):
+ """MatchOIDCIdentity defines the criteria for matching the identity while verifying an OCI
+ artifact.
+
+ :ivar issuer: The regex pattern to match against to verify the OIDC issuer.
+ :vartype issuer: str
+ :ivar subject: The regex pattern to match against to verify the identity subject.
+ :vartype subject: str
+ """
+
+ _attribute_map = {
+ "issuer": {"key": "issuer", "type": "str"},
+ "subject": {"key": "subject", "type": "str"},
+ }
+
+ def __init__(self, *, issuer: Optional[str] = None, subject: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword issuer: The regex pattern to match against to verify the OIDC issuer.
+ :paramtype issuer: str
+ :keyword subject: The regex pattern to match against to verify the identity subject.
+ :paramtype subject: str
+ """
+ super().__init__(**kwargs)
+ self.issuer = issuer
+ self.subject = subject
+
+
+class MatchOidcIdentityPatchDefinition(_serialization.Model):
+ """MatchOIDCIdentity defines the criteria for matching the identity while verifying an OCI
+ artifact.
+
+ :ivar issuer: The regex pattern to match against to verify the OIDC issuer.
+ :vartype issuer: str
+ :ivar subject: The regex pattern to match against to verify the identity subject.
+ :vartype subject: str
+ """
+
+ _attribute_map = {
+ "issuer": {"key": "issuer", "type": "str"},
+ "subject": {"key": "subject", "type": "str"},
+ }
+
+ def __init__(self, *, issuer: Optional[str] = None, subject: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword issuer: The regex pattern to match against to verify the OIDC issuer.
+ :paramtype issuer: str
+ :keyword subject: The regex pattern to match against to verify the identity subject.
+ :paramtype subject: str
+ """
+ super().__init__(**kwargs)
+ self.issuer = issuer
+ self.subject = subject
+
+
+class ObjectReferenceDefinition(_serialization.Model):
+ """Object reference to a Kubernetes object on a cluster.
+
+ :ivar name: Name of the object.
+ :vartype name: str
+ :ivar namespace: Namespace of the object.
+ :vartype namespace: str
+ """
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "namespace": {"key": "namespace", "type": "str"},
+ }
+
+ def __init__(self, *, name: Optional[str] = None, namespace: Optional[str] = None, **kwargs: Any) -> None:
+ """
+ :keyword name: Name of the object.
+ :paramtype name: str
+ :keyword namespace: Namespace of the object.
+ :paramtype namespace: str
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.namespace = namespace
+
+
+class ObjectStatusConditionDefinition(_serialization.Model):
+ """Status condition of Kubernetes object.
+
+ :ivar last_transition_time: Last time this status condition has changed.
+ :vartype last_transition_time: ~datetime.datetime
+ :ivar message: A more verbose description of the object status condition.
+ :vartype message: str
+ :ivar reason: Reason for the specified status condition type status.
+ :vartype reason: str
+ :ivar status: Status of the Kubernetes object condition type.
+ :vartype status: str
+ :ivar type: Object status condition type for this object.
+ :vartype type: str
+ """
+
+ _attribute_map = {
+ "last_transition_time": {"key": "lastTransitionTime", "type": "iso-8601"},
+ "message": {"key": "message", "type": "str"},
+ "reason": {"key": "reason", "type": "str"},
+ "status": {"key": "status", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ last_transition_time: Optional[datetime.datetime] = None,
+ message: Optional[str] = None,
+ reason: Optional[str] = None,
+ status: Optional[str] = None,
+ type: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword last_transition_time: Last time this status condition has changed.
+ :paramtype last_transition_time: ~datetime.datetime
+ :keyword message: A more verbose description of the object status condition.
+ :paramtype message: str
+ :keyword reason: Reason for the specified status condition type status.
+ :paramtype reason: str
+ :keyword status: Status of the Kubernetes object condition type.
+ :paramtype status: str
+ :keyword type: Object status condition type for this object.
+ :paramtype type: str
+ """
+ super().__init__(**kwargs)
+ self.last_transition_time = last_transition_time
+ self.message = message
+ self.reason = reason
+ self.status = status
+ self.type = type
+
+
+class ObjectStatusDefinition(_serialization.Model):
+ """Statuses of objects deployed by the user-specified kustomizations from the git repository.
+
+ :ivar name: Name of the applied object.
+ :vartype name: str
+ :ivar namespace: Namespace of the applied object.
+ :vartype namespace: str
+ :ivar kind: Kind of the applied object.
+ :vartype kind: str
+ :ivar compliance_state: Compliance state of the applied object showing whether the applied
+ object has come into a ready state on the cluster. Known values are: "Compliant",
+ "Non-Compliant", "Pending", "Suspended", and "Unknown".
+ :vartype compliance_state: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxComplianceState
+ :ivar applied_by: Object reference to the Kustomization that applied this object.
+ :vartype applied_by:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ObjectReferenceDefinition
+ :ivar status_conditions: List of Kubernetes object status conditions present on the cluster.
+ :vartype status_conditions:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ObjectStatusConditionDefinition]
+ :ivar helm_release_properties: Additional properties that are provided from objects of the
+ HelmRelease kind.
+ :vartype helm_release_properties:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.HelmReleasePropertiesDefinition
+ """
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "namespace": {"key": "namespace", "type": "str"},
+ "kind": {"key": "kind", "type": "str"},
+ "compliance_state": {"key": "complianceState", "type": "str"},
+ "applied_by": {"key": "appliedBy", "type": "ObjectReferenceDefinition"},
+ "status_conditions": {"key": "statusConditions", "type": "[ObjectStatusConditionDefinition]"},
+ "helm_release_properties": {"key": "helmReleaseProperties", "type": "HelmReleasePropertiesDefinition"},
+ }
+
+ def __init__(
+ self,
+ *,
+ name: Optional[str] = None,
+ namespace: Optional[str] = None,
+ kind: Optional[str] = None,
+ compliance_state: Union[str, "_models.FluxComplianceState"] = "Unknown",
+ applied_by: Optional["_models.ObjectReferenceDefinition"] = None,
+ status_conditions: Optional[List["_models.ObjectStatusConditionDefinition"]] = None,
+ helm_release_properties: Optional["_models.HelmReleasePropertiesDefinition"] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword name: Name of the applied object.
+ :paramtype name: str
+ :keyword namespace: Namespace of the applied object.
+ :paramtype namespace: str
+ :keyword kind: Kind of the applied object.
+ :paramtype kind: str
+ :keyword compliance_state: Compliance state of the applied object showing whether the applied
+ object has come into a ready state on the cluster. Known values are: "Compliant",
+ "Non-Compliant", "Pending", "Suspended", and "Unknown".
+ :paramtype compliance_state: str or
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxComplianceState
+ :keyword applied_by: Object reference to the Kustomization that applied this object.
+ :paramtype applied_by:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ObjectReferenceDefinition
+ :keyword status_conditions: List of Kubernetes object status conditions present on the cluster.
+ :paramtype status_conditions:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ObjectStatusConditionDefinition]
+ :keyword helm_release_properties: Additional properties that are provided from objects of the
+ HelmRelease kind.
+ :paramtype helm_release_properties:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.HelmReleasePropertiesDefinition
+ """
+ super().__init__(**kwargs)
+ self.name = name
+ self.namespace = namespace
+ self.kind = kind
+ self.compliance_state = compliance_state
+ self.applied_by = applied_by
+ self.status_conditions = status_conditions
+ self.helm_release_properties = helm_release_properties
+
+
+class OCIRepositoryDefinition(_serialization.Model):
+ """Parameters to reconcile to the OCIRepository source kind type.
+
+ :ivar url: The URL to sync for the flux configuration OCI repository.
+ :vartype url: str
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster OCI repository
+ source with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster OCI
+ repository source with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar repository_ref: The source reference for the OCIRepository object.
+ :vartype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryRefDefinition
+ :ivar layer_selector: The layer to be pulled from the OCI artifact.
+ :vartype layer_selector:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.LayerSelectorDefinition
+ :ivar verify: Verification of the authenticity of an OCI Artifact.
+ :vartype verify:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.VerifyDefinition
+ :ivar insecure: Specify whether to allow connecting to a non-TLS HTTP container registry.
+ :vartype insecure: bool
+ :ivar use_workload_identity: Specifies whether to use Workload Identity to authenticate with
+ the OCI repository.
+ :vartype use_workload_identity: bool
+ :ivar service_account_name: The service account name to authenticate with the OCI repository.
+ :vartype service_account_name: str
+ :ivar tls_config: Parameters to authenticate using TLS config for OCI repository.
+ :vartype tls_config:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.TlsConfigDefinition
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "repository_ref": {"key": "repositoryRef", "type": "OCIRepositoryRefDefinition"},
+ "layer_selector": {"key": "layerSelector", "type": "LayerSelectorDefinition"},
+ "verify": {"key": "verify", "type": "VerifyDefinition"},
+ "insecure": {"key": "insecure", "type": "bool"},
+ "use_workload_identity": {"key": "useWorkloadIdentity", "type": "bool"},
+ "service_account_name": {"key": "serviceAccountName", "type": "str"},
+ "tls_config": {"key": "tlsConfig", "type": "TlsConfigDefinition"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ timeout_in_seconds: int = 600,
+ sync_interval_in_seconds: int = 600,
+ repository_ref: Optional["_models.OCIRepositoryRefDefinition"] = None,
+ layer_selector: Optional["_models.LayerSelectorDefinition"] = None,
+ verify: Optional["_models.VerifyDefinition"] = None,
+ insecure: bool = False,
+ use_workload_identity: bool = False,
+ service_account_name: Optional[str] = None,
+ tls_config: Optional["_models.TlsConfigDefinition"] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration OCI repository.
+ :paramtype url: str
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster OCI
+ repository source with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster OCI
+ repository source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword repository_ref: The source reference for the OCIRepository object.
+ :paramtype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryRefDefinition
+ :keyword layer_selector: The layer to be pulled from the OCI artifact.
+ :paramtype layer_selector:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.LayerSelectorDefinition
+ :keyword verify: Verification of the authenticity of an OCI Artifact.
+ :paramtype verify:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.VerifyDefinition
+ :keyword insecure: Specify whether to allow connecting to a non-TLS HTTP container registry.
+ :paramtype insecure: bool
+ :keyword use_workload_identity: Specifies whether to use Workload Identity to authenticate with
+ the OCI repository.
+ :paramtype use_workload_identity: bool
+ :keyword service_account_name: The service account name to authenticate with the OCI
+ repository.
+ :paramtype service_account_name: str
+ :keyword tls_config: Parameters to authenticate using TLS config for OCI repository.
+ :paramtype tls_config:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.TlsConfigDefinition
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.repository_ref = repository_ref
+ self.layer_selector = layer_selector
+ self.verify = verify
+ self.insecure = insecure
+ self.use_workload_identity = use_workload_identity
+ self.service_account_name = service_account_name
+ self.tls_config = tls_config
+ self.local_auth_ref = local_auth_ref
+
+
+class OCIRepositoryPatchDefinition(_serialization.Model):
+ """Parameters to reconcile to the OCIRepository source kind type.
+
+ :ivar url: The URL to sync for the flux configuration OCI repository.
+ :vartype url: str
+ :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster OCI repository
+ source with the remote.
+ :vartype timeout_in_seconds: int
+ :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster OCI
+ repository source with the remote.
+ :vartype sync_interval_in_seconds: int
+ :ivar repository_ref: The source reference for the OCIRepository object.
+ :vartype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryRefPatchDefinition
+ :ivar layer_selector: The layer to be pulled from the OCI artifact.
+ :vartype layer_selector:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.LayerSelectorPatchDefinition
+ :ivar verify: Verification of the authenticity of an OCI Artifact.
+ :vartype verify:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.VerifyPatchDefinition
+ :ivar insecure: Specify whether to allow connecting to a non-TLS HTTP container registry.
+ :vartype insecure: bool
+ :ivar use_workload_identity: Specifies whether to use Workload Identity to authenticate with
+ the OCI repository.
+ :vartype use_workload_identity: bool
+ :ivar service_account_name: The service account name to authenticate with the OCI repository.
+ :vartype service_account_name: str
+ :ivar tls_config: Parameters to authenticate using TLS config for OCI repository.
+ :vartype tls_config:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.TlsConfigPatchDefinition
+ :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :vartype local_auth_ref: str
+ """
+
+ _attribute_map = {
+ "url": {"key": "url", "type": "str"},
+ "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"},
+ "sync_interval_in_seconds": {"key": "syncIntervalInSeconds", "type": "int"},
+ "repository_ref": {"key": "repositoryRef", "type": "OCIRepositoryRefPatchDefinition"},
+ "layer_selector": {"key": "layerSelector", "type": "LayerSelectorPatchDefinition"},
+ "verify": {"key": "verify", "type": "VerifyPatchDefinition"},
+ "insecure": {"key": "insecure", "type": "bool"},
+ "use_workload_identity": {"key": "useWorkloadIdentity", "type": "bool"},
+ "service_account_name": {"key": "serviceAccountName", "type": "str"},
+ "tls_config": {"key": "tlsConfig", "type": "TlsConfigPatchDefinition"},
+ "local_auth_ref": {"key": "localAuthRef", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ url: Optional[str] = None,
+ timeout_in_seconds: Optional[int] = None,
+ sync_interval_in_seconds: Optional[int] = None,
+ repository_ref: Optional["_models.OCIRepositoryRefPatchDefinition"] = None,
+ layer_selector: Optional["_models.LayerSelectorPatchDefinition"] = None,
+ verify: Optional["_models.VerifyPatchDefinition"] = None,
+ insecure: bool = False,
+ use_workload_identity: bool = False,
+ service_account_name: Optional[str] = None,
+ tls_config: Optional["_models.TlsConfigPatchDefinition"] = None,
+ local_auth_ref: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword url: The URL to sync for the flux configuration OCI repository.
+ :paramtype url: str
+ :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster OCI
+ repository source with the remote.
+ :paramtype timeout_in_seconds: int
+ :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster OCI
+ repository source with the remote.
+ :paramtype sync_interval_in_seconds: int
+ :keyword repository_ref: The source reference for the OCIRepository object.
+ :paramtype repository_ref:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OCIRepositoryRefPatchDefinition
+ :keyword layer_selector: The layer to be pulled from the OCI artifact.
+ :paramtype layer_selector:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.LayerSelectorPatchDefinition
+ :keyword verify: Verification of the authenticity of an OCI Artifact.
+ :paramtype verify:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.VerifyPatchDefinition
+ :keyword insecure: Specify whether to allow connecting to a non-TLS HTTP container registry.
+ :paramtype insecure: bool
+ :keyword use_workload_identity: Specifies whether to use Workload Identity to authenticate with
+ the OCI repository.
+ :paramtype use_workload_identity: bool
+ :keyword service_account_name: The service account name to authenticate with the OCI
+ repository.
+ :paramtype service_account_name: str
+ :keyword tls_config: Parameters to authenticate using TLS config for OCI repository.
+ :paramtype tls_config:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.TlsConfigPatchDefinition
+ :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the
+ authentication secret rather than the managed or user-provided configuration secrets.
+ :paramtype local_auth_ref: str
+ """
+ super().__init__(**kwargs)
+ self.url = url
+ self.timeout_in_seconds = timeout_in_seconds
+ self.sync_interval_in_seconds = sync_interval_in_seconds
+ self.repository_ref = repository_ref
+ self.layer_selector = layer_selector
+ self.verify = verify
+ self.insecure = insecure
+ self.use_workload_identity = use_workload_identity
+ self.service_account_name = service_account_name
+ self.tls_config = tls_config
+ self.local_auth_ref = local_auth_ref
+
+
+class OCIRepositoryRefDefinition(_serialization.Model):
+ """The source reference for the OCIRepository object.
+
+ :ivar tag: The OCI repository image tag name to pull. This defaults to 'latest'.
+ :vartype tag: str
+ :ivar semver: The semver range used to match against OCI repository tags. This takes precedence
+ over tag.
+ :vartype semver: str
+ :ivar digest: The image digest to pull from OCI repository, the value should be in the format
+ ‘sha256:’. This takes precedence over semver.
+ :vartype digest: str
+ """
+
+ _attribute_map = {
+ "tag": {"key": "tag", "type": "str"},
+ "semver": {"key": "semver", "type": "str"},
+ "digest": {"key": "digest", "type": "str"},
+ }
+
+ def __init__(
+ self, *, tag: Optional[str] = None, semver: Optional[str] = None, digest: Optional[str] = None, **kwargs: Any
+ ) -> None:
+ """
+ :keyword tag: The OCI repository image tag name to pull. This defaults to 'latest'.
+ :paramtype tag: str
+ :keyword semver: The semver range used to match against OCI repository tags. This takes
+ precedence over tag.
+ :paramtype semver: str
+ :keyword digest: The image digest to pull from OCI repository, the value should be in the
+ format ‘sha256:’. This takes precedence over semver.
+ :paramtype digest: str
+ """
+ super().__init__(**kwargs)
+ self.tag = tag
+ self.semver = semver
+ self.digest = digest
+
+
+class OCIRepositoryRefPatchDefinition(_serialization.Model):
+ """The source reference for the OCIRepository object.
+
+ :ivar tag: The OCI repository image tag name to pull. This defaults to 'latest'.
+ :vartype tag: str
+ :ivar semver: The semver range used to match against OCI repository tags. This takes precedence
+ over tag.
+ :vartype semver: str
+ :ivar digest: The image digest to pull from OCI repository, the value should be in the format
+ ‘sha256:’. This takes precedence over semver.
+ :vartype digest: str
+ """
+
+ _attribute_map = {
+ "tag": {"key": "tag", "type": "str"},
+ "semver": {"key": "semver", "type": "str"},
+ "digest": {"key": "digest", "type": "str"},
+ }
+
+ def __init__(
+ self, *, tag: Optional[str] = None, semver: Optional[str] = None, digest: Optional[str] = None, **kwargs: Any
+ ) -> None:
+ """
+ :keyword tag: The OCI repository image tag name to pull. This defaults to 'latest'.
+ :paramtype tag: str
+ :keyword semver: The semver range used to match against OCI repository tags. This takes
+ precedence over tag.
+ :paramtype semver: str
+ :keyword digest: The image digest to pull from OCI repository, the value should be in the
+ format ‘sha256:’. This takes precedence over semver.
+ :paramtype digest: str
+ """
+ super().__init__(**kwargs)
+ self.tag = tag
+ self.semver = semver
+ self.digest = digest
+
+
+class OperationStatusResult(_serialization.Model):
+ """The current status of an async operation.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar id: Fully qualified ID for the async operation.
+ :vartype id: str
+ :ivar name: Name of the async operation.
+ :vartype name: str
+ :ivar status: Operation status. Required.
+ :vartype status: str
+ :ivar properties: Additional information, if available.
+ :vartype properties: dict[str, str]
+ :ivar error: If present, details of the operation error.
+ :vartype error: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.ErrorDetail
+ """
+
+ _validation = {
+ "status": {"required": True},
+ "error": {"readonly": True},
+ }
+
+ _attribute_map = {
+ "id": {"key": "id", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "status": {"key": "status", "type": "str"},
+ "properties": {"key": "properties", "type": "{str}"},
+ "error": {"key": "error", "type": "ErrorDetail"},
+ }
+
+ def __init__(
+ self,
+ *,
+ status: str,
+ id: Optional[str] = None, # pylint: disable=redefined-builtin
+ name: Optional[str] = None,
+ properties: Optional[Dict[str, str]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword id: Fully qualified ID for the async operation.
+ :paramtype id: str
+ :keyword name: Name of the async operation.
+ :paramtype name: str
+ :keyword status: Operation status. Required.
+ :paramtype status: str
+ :keyword properties: Additional information, if available.
+ :paramtype properties: dict[str, str]
+ """
+ super().__init__(**kwargs)
+ self.id = id
+ self.name = name
+ self.status = status
+ self.properties = properties
+ self.error = None
+
+
+class PostBuildDefinition(_serialization.Model):
+ """The postBuild definitions defining variable substitutions for this Kustomization after
+ kustomize build.
+
+ :ivar substitute: Key/value pairs holding the variables to be substituted in this
+ Kustomization.
+ :vartype substitute: dict[str, str]
+ :ivar substitute_from: Array of ConfigMaps/Secrets from which the variables are substituted for
+ this Kustomization.
+ :vartype substitute_from:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SubstituteFromDefinition]
+ """
+
+ _attribute_map = {
+ "substitute": {"key": "substitute", "type": "{str}"},
+ "substitute_from": {"key": "substituteFrom", "type": "[SubstituteFromDefinition]"},
+ }
+
+ def __init__(
+ self,
+ *,
+ substitute: Optional[Dict[str, str]] = None,
+ substitute_from: Optional[List["_models.SubstituteFromDefinition"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword substitute: Key/value pairs holding the variables to be substituted in this
+ Kustomization.
+ :paramtype substitute: dict[str, str]
+ :keyword substitute_from: Array of ConfigMaps/Secrets from which the variables are substituted
+ for this Kustomization.
+ :paramtype substitute_from:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SubstituteFromDefinition]
+ """
+ super().__init__(**kwargs)
+ self.substitute = substitute
+ self.substitute_from = substitute_from
+
+
+class PostBuildPatchDefinition(_serialization.Model):
+ """The postBuild definitions defining variable substitutions for this Kustomization after
+ kustomize build.
+
+ :ivar substitute: Key/value pairs holding the variables to be substituted in this
+ Kustomization.
+ :vartype substitute: dict[str, str]
+ :ivar substitute_from: Array of ConfigMaps/Secrets from which the variables are substituted for
+ this Kustomization.
+ :vartype substitute_from:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SubstituteFromPatchDefinition]
+ """
+
+ _attribute_map = {
+ "substitute": {"key": "substitute", "type": "{str}"},
+ "substitute_from": {"key": "substituteFrom", "type": "[SubstituteFromPatchDefinition]"},
+ }
+
+ def __init__(
+ self,
+ *,
+ substitute: Optional[Dict[str, str]] = None,
+ substitute_from: Optional[List["_models.SubstituteFromPatchDefinition"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword substitute: Key/value pairs holding the variables to be substituted in this
+ Kustomization.
+ :paramtype substitute: dict[str, str]
+ :keyword substitute_from: Array of ConfigMaps/Secrets from which the variables are substituted
+ for this Kustomization.
+ :paramtype substitute_from:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.SubstituteFromPatchDefinition]
+ """
+ super().__init__(**kwargs)
+ self.substitute = substitute
+ self.substitute_from = substitute_from
+
+
+class RepositoryRefDefinition(_serialization.Model):
+ """The source reference for the GitRepository object.
+
+ :ivar branch: The git repository branch name to checkout.
+ :vartype branch: str
+ :ivar tag: The git repository tag name to checkout. This takes precedence over branch.
+ :vartype tag: str
+ :ivar semver: The semver range used to match against git repository tags. This takes precedence
+ over tag.
+ :vartype semver: str
+ :ivar commit: The commit SHA to checkout. This value must be combined with the branch name to
+ be valid. This takes precedence over semver.
+ :vartype commit: str
+ """
+
+ _attribute_map = {
+ "branch": {"key": "branch", "type": "str"},
+ "tag": {"key": "tag", "type": "str"},
+ "semver": {"key": "semver", "type": "str"},
+ "commit": {"key": "commit", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ branch: Optional[str] = None,
+ tag: Optional[str] = None,
+ semver: Optional[str] = None,
+ commit: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword branch: The git repository branch name to checkout.
+ :paramtype branch: str
+ :keyword tag: The git repository tag name to checkout. This takes precedence over branch.
+ :paramtype tag: str
+ :keyword semver: The semver range used to match against git repository tags. This takes
+ precedence over tag.
+ :paramtype semver: str
+ :keyword commit: The commit SHA to checkout. This value must be combined with the branch name
+ to be valid. This takes precedence over semver.
+ :paramtype commit: str
+ """
+ super().__init__(**kwargs)
+ self.branch = branch
+ self.tag = tag
+ self.semver = semver
+ self.commit = commit
+
+
+class ServicePrincipalDefinition(_serialization.Model):
+ """Parameters to authenticate using Service Principal.
+
+ :ivar client_id: The client Id for authenticating a Service Principal.
+ :vartype client_id: str
+ :ivar tenant_id: The tenant Id for authenticating a Service Principal.
+ :vartype tenant_id: str
+ :ivar client_secret: The client secret for authenticating a Service Principal.
+ :vartype client_secret: str
+ :ivar client_certificate: Base64-encoded certificate used to authenticate a Service Principal.
+ :vartype client_certificate: str
+ :ivar client_certificate_password: The password for the certificate used to authenticate a
+ Service Principal.
+ :vartype client_certificate_password: str
+ :ivar client_certificate_send_chain: Specifies whether to include x5c header in client claims
+ when acquiring a token to enable subject name / issuer based authentication for the Client
+ Certificate.
+ :vartype client_certificate_send_chain: bool
+ """
+
+ _attribute_map = {
+ "client_id": {"key": "clientId", "type": "str"},
+ "tenant_id": {"key": "tenantId", "type": "str"},
+ "client_secret": {"key": "clientSecret", "type": "str"},
+ "client_certificate": {"key": "clientCertificate", "type": "str"},
+ "client_certificate_password": {"key": "clientCertificatePassword", "type": "str"},
+ "client_certificate_send_chain": {"key": "clientCertificateSendChain", "type": "bool"},
+ }
+
+ def __init__(
+ self,
+ *,
+ client_id: Optional[str] = None,
+ tenant_id: Optional[str] = None,
+ client_secret: Optional[str] = None,
+ client_certificate: Optional[str] = None,
+ client_certificate_password: Optional[str] = None,
+ client_certificate_send_chain: bool = False,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword client_id: The client Id for authenticating a Service Principal.
+ :paramtype client_id: str
+ :keyword tenant_id: The tenant Id for authenticating a Service Principal.
+ :paramtype tenant_id: str
+ :keyword client_secret: The client secret for authenticating a Service Principal.
+ :paramtype client_secret: str
+ :keyword client_certificate: Base64-encoded certificate used to authenticate a Service
+ Principal.
+ :paramtype client_certificate: str
+ :keyword client_certificate_password: The password for the certificate used to authenticate a
+ Service Principal.
+ :paramtype client_certificate_password: str
+ :keyword client_certificate_send_chain: Specifies whether to include x5c header in client
+ claims when acquiring a token to enable subject name / issuer based authentication for the
+ Client Certificate.
+ :paramtype client_certificate_send_chain: bool
+ """
+ super().__init__(**kwargs)
+ self.client_id = client_id
+ self.tenant_id = tenant_id
+ self.client_secret = client_secret
+ self.client_certificate = client_certificate
+ self.client_certificate_password = client_certificate_password
+ self.client_certificate_send_chain = client_certificate_send_chain
+
+
+class ServicePrincipalPatchDefinition(_serialization.Model):
+ """Parameters to authenticate using Service Principal.
+
+ :ivar client_id: The client Id for authenticating a Service Principal.
+ :vartype client_id: str
+ :ivar tenant_id: The tenant Id for authenticating a Service Principal.
+ :vartype tenant_id: str
+ :ivar client_secret: The client secret for authenticating a Service Principal.
+ :vartype client_secret: str
+ :ivar client_certificate: Base64-encoded certificate used to authenticate a Service Principal.
+ :vartype client_certificate: str
+ :ivar client_certificate_password: The password for the certificate used to authenticate a
+ Service Principal.
+ :vartype client_certificate_password: str
+ :ivar client_certificate_send_chain: Specifies whether to include x5c header in client claims
+ when acquiring a token to enable subject name / issuer based authentication for the Client
+ Certificate.
+ :vartype client_certificate_send_chain: bool
+ """
+
+ _attribute_map = {
+ "client_id": {"key": "clientId", "type": "str"},
+ "tenant_id": {"key": "tenantId", "type": "str"},
+ "client_secret": {"key": "clientSecret", "type": "str"},
+ "client_certificate": {"key": "clientCertificate", "type": "str"},
+ "client_certificate_password": {"key": "clientCertificatePassword", "type": "str"},
+ "client_certificate_send_chain": {"key": "clientCertificateSendChain", "type": "bool"},
+ }
+
+ def __init__(
+ self,
+ *,
+ client_id: Optional[str] = None,
+ tenant_id: Optional[str] = None,
+ client_secret: Optional[str] = None,
+ client_certificate: Optional[str] = None,
+ client_certificate_password: Optional[str] = None,
+ client_certificate_send_chain: Optional[bool] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword client_id: The client Id for authenticating a Service Principal.
+ :paramtype client_id: str
+ :keyword tenant_id: The tenant Id for authenticating a Service Principal.
+ :paramtype tenant_id: str
+ :keyword client_secret: The client secret for authenticating a Service Principal.
+ :paramtype client_secret: str
+ :keyword client_certificate: Base64-encoded certificate used to authenticate a Service
+ Principal.
+ :paramtype client_certificate: str
+ :keyword client_certificate_password: The password for the certificate used to authenticate a
+ Service Principal.
+ :paramtype client_certificate_password: str
+ :keyword client_certificate_send_chain: Specifies whether to include x5c header in client
+ claims when acquiring a token to enable subject name / issuer based authentication for the
+ Client Certificate.
+ :paramtype client_certificate_send_chain: bool
+ """
+ super().__init__(**kwargs)
+ self.client_id = client_id
+ self.tenant_id = tenant_id
+ self.client_secret = client_secret
+ self.client_certificate = client_certificate
+ self.client_certificate_password = client_certificate_password
+ self.client_certificate_send_chain = client_certificate_send_chain
+
+
+class SubstituteFromDefinition(_serialization.Model):
+ """Array of ConfigMaps/Secrets from which the variables are substituted for this Kustomization.
+
+ :ivar kind: Define whether it is ConfigMap or Secret that holds the variables to be used in
+ substitution.
+ :vartype kind: str
+ :ivar name: Name of the ConfigMap/Secret that holds the variables to be used in substitution.
+ :vartype name: str
+ :ivar optional: Set to True to proceed without ConfigMap/Secret, if it is not present.
+ :vartype optional: bool
+ """
+
+ _attribute_map = {
+ "kind": {"key": "kind", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "optional": {"key": "optional", "type": "bool"},
+ }
+
+ def __init__(
+ self, *, kind: Optional[str] = None, name: Optional[str] = None, optional: bool = False, **kwargs: Any
+ ) -> None:
+ """
+ :keyword kind: Define whether it is ConfigMap or Secret that holds the variables to be used in
+ substitution.
+ :paramtype kind: str
+ :keyword name: Name of the ConfigMap/Secret that holds the variables to be used in
+ substitution.
+ :paramtype name: str
+ :keyword optional: Set to True to proceed without ConfigMap/Secret, if it is not present.
+ :paramtype optional: bool
+ """
+ super().__init__(**kwargs)
+ self.kind = kind
+ self.name = name
+ self.optional = optional
+
+
+class SubstituteFromPatchDefinition(_serialization.Model):
+ """Array of ConfigMaps/Secrets from which the variables are substituted for this Kustomization.
+
+ :ivar kind: Define whether it is ConfigMap or Secret that holds the variables to be used in
+ substitution.
+ :vartype kind: str
+ :ivar name: Name of the ConfigMap/Secret that holds the variables to be used in substitution.
+ :vartype name: str
+ :ivar optional: Set to True to proceed without ConfigMap/Secret, if it is not present.
+ :vartype optional: bool
+ """
+
+ _attribute_map = {
+ "kind": {"key": "kind", "type": "str"},
+ "name": {"key": "name", "type": "str"},
+ "optional": {"key": "optional", "type": "bool"},
+ }
+
+ def __init__(
+ self, *, kind: Optional[str] = None, name: Optional[str] = None, optional: bool = False, **kwargs: Any
+ ) -> None:
+ """
+ :keyword kind: Define whether it is ConfigMap or Secret that holds the variables to be used in
+ substitution.
+ :paramtype kind: str
+ :keyword name: Name of the ConfigMap/Secret that holds the variables to be used in
+ substitution.
+ :paramtype name: str
+ :keyword optional: Set to True to proceed without ConfigMap/Secret, if it is not present.
+ :paramtype optional: bool
+ """
+ super().__init__(**kwargs)
+ self.kind = kind
+ self.name = name
+ self.optional = optional
+
+
+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.kubernetesconfiguration.v2024_04_01_preview.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.kubernetesconfiguration.v2024_04_01_preview.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: Any
+ ) -> None:
+ """
+ :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.kubernetesconfiguration.v2024_04_01_preview.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.kubernetesconfiguration.v2024_04_01_preview.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 TlsConfigDefinition(_serialization.Model):
+ """Parameters to authenticate using TLS config for OCI repository.
+
+ :ivar client_certificate: Base64-encoded certificate used to authenticate a client with the OCI
+ repository.
+ :vartype client_certificate: str
+ :ivar private_key: Base64-encoded private key used to authenticate a client with the OCI
+ repository.
+ :vartype private_key: str
+ :ivar ca_certificate: Base64-encoded CA certificate used to verify the server.
+ :vartype ca_certificate: str
+ """
+
+ _attribute_map = {
+ "client_certificate": {"key": "clientCertificate", "type": "str"},
+ "private_key": {"key": "privateKey", "type": "str"},
+ "ca_certificate": {"key": "caCertificate", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ client_certificate: Optional[str] = None,
+ private_key: Optional[str] = None,
+ ca_certificate: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword client_certificate: Base64-encoded certificate used to authenticate a client with the
+ OCI repository.
+ :paramtype client_certificate: str
+ :keyword private_key: Base64-encoded private key used to authenticate a client with the OCI
+ repository.
+ :paramtype private_key: str
+ :keyword ca_certificate: Base64-encoded CA certificate used to verify the server.
+ :paramtype ca_certificate: str
+ """
+ super().__init__(**kwargs)
+ self.client_certificate = client_certificate
+ self.private_key = private_key
+ self.ca_certificate = ca_certificate
+
+
+class TlsConfigPatchDefinition(_serialization.Model):
+ """Parameters to authenticate using TLS config for OCI repository.
+
+ :ivar client_certificate: Base64-encoded certificate used to authenticate a client with the OCI
+ repository.
+ :vartype client_certificate: str
+ :ivar private_key: Base64-encoded private key used to authenticate a client with the OCI
+ repository.
+ :vartype private_key: str
+ :ivar ca_certificate: Base64-encoded CA certificate used to verify the server.
+ :vartype ca_certificate: str
+ """
+
+ _attribute_map = {
+ "client_certificate": {"key": "clientCertificate", "type": "str"},
+ "private_key": {"key": "privateKey", "type": "str"},
+ "ca_certificate": {"key": "caCertificate", "type": "str"},
+ }
+
+ def __init__(
+ self,
+ *,
+ client_certificate: Optional[str] = None,
+ private_key: Optional[str] = None,
+ ca_certificate: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword client_certificate: Base64-encoded certificate used to authenticate a client with the
+ OCI repository.
+ :paramtype client_certificate: str
+ :keyword private_key: Base64-encoded private key used to authenticate a client with the OCI
+ repository.
+ :paramtype private_key: str
+ :keyword ca_certificate: Base64-encoded CA certificate used to verify the server.
+ :paramtype ca_certificate: str
+ """
+ super().__init__(**kwargs)
+ self.client_certificate = client_certificate
+ self.private_key = private_key
+ self.ca_certificate = ca_certificate
+
+
+class VerifyDefinition(_serialization.Model):
+ """Parameters to verify the authenticity of an OCI Artifact.
+
+ :ivar provider: Verification provider name.
+ :vartype provider: str
+ :ivar verification_config: An object containing trusted public keys of trusted authors.
+ :vartype verification_config: dict[str, str]
+ :ivar match_oidc_identity: Array defining the criteria for matching the identity while
+ verifying an OCI artifact.
+ :vartype match_oidc_identity:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.MatchOidcIdentityDefinition]
+ """
+
+ _attribute_map = {
+ "provider": {"key": "provider", "type": "str"},
+ "verification_config": {"key": "verificationConfig", "type": "{str}"},
+ "match_oidc_identity": {"key": "matchOidcIdentity", "type": "[MatchOidcIdentityDefinition]"},
+ }
+
+ def __init__(
+ self,
+ *,
+ provider: Optional[str] = None,
+ verification_config: Optional[Dict[str, str]] = None,
+ match_oidc_identity: Optional[List["_models.MatchOidcIdentityDefinition"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword provider: Verification provider name.
+ :paramtype provider: str
+ :keyword verification_config: An object containing trusted public keys of trusted authors.
+ :paramtype verification_config: dict[str, str]
+ :keyword match_oidc_identity: Array defining the criteria for matching the identity while
+ verifying an OCI artifact.
+ :paramtype match_oidc_identity:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.MatchOidcIdentityDefinition]
+ """
+ super().__init__(**kwargs)
+ self.provider = provider
+ self.verification_config = verification_config
+ self.match_oidc_identity = match_oidc_identity
+
+
+class VerifyPatchDefinition(_serialization.Model):
+ """Parameters to verify the authenticity of an OCI Artifact.
+
+ :ivar provider: Verification provider name.
+ :vartype provider: str
+ :ivar verification_config: An object containing trusted public keys of trusted authors.
+ :vartype verification_config: dict[str, str]
+ :ivar match_oidc_identity: Array defining the criteria for matching the OIDC identity while
+ verifying an OCI artifact.
+ :vartype match_oidc_identity:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.MatchOidcIdentityPatchDefinition]
+ """
+
+ _attribute_map = {
+ "provider": {"key": "provider", "type": "str"},
+ "verification_config": {"key": "verificationConfig", "type": "{str}"},
+ "match_oidc_identity": {"key": "matchOidcIdentity", "type": "[MatchOidcIdentityPatchDefinition]"},
+ }
+
+ def __init__(
+ self,
+ *,
+ provider: Optional[str] = None,
+ verification_config: Optional[Dict[str, str]] = None,
+ match_oidc_identity: Optional[List["_models.MatchOidcIdentityPatchDefinition"]] = None,
+ **kwargs: Any
+ ) -> None:
+ """
+ :keyword provider: Verification provider name.
+ :paramtype provider: str
+ :keyword verification_config: An object containing trusted public keys of trusted authors.
+ :paramtype verification_config: dict[str, str]
+ :keyword match_oidc_identity: Array defining the criteria for matching the OIDC identity while
+ verifying an OCI artifact.
+ :paramtype match_oidc_identity:
+ list[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.MatchOidcIdentityPatchDefinition]
+ """
+ super().__init__(**kwargs)
+ self.provider = provider
+ self.verification_config = verification_config
+ self.match_oidc_identity = match_oidc_identity
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_patch.py
new file mode 100644
index 0000000000000..f7dd32510333d
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_source_control_configuration_client_enums.py
new file mode 100644
index 0000000000000..607ade03c9ccc
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/models/_source_control_configuration_client_enums.py
@@ -0,0 +1,75 @@
+# 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 CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """The type of identity that created the resource."""
+
+ USER = "User"
+ APPLICATION = "Application"
+ MANAGED_IDENTITY = "ManagedIdentity"
+ KEY = "Key"
+
+
+class FluxComplianceState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Compliance state of the cluster object."""
+
+ COMPLIANT = "Compliant"
+ NON_COMPLIANT = "Non-Compliant"
+ PENDING = "Pending"
+ SUSPENDED = "Suspended"
+ UNKNOWN = "Unknown"
+
+
+class KustomizationValidationType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Specify whether to validate the Kubernetes objects referenced in the Kustomization before
+ applying them to the cluster.
+ """
+
+ NONE = "none"
+ CLIENT = "client"
+ SERVER = "server"
+
+
+class OperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """The operation to be performed on the selected layer. The default value is 'extract', but it can
+ be set to 'copy'.
+ """
+
+ EXTRACT = "extract"
+ COPY = "copy"
+
+
+class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """The provisioning state of the resource."""
+
+ SUCCEEDED = "Succeeded"
+ FAILED = "Failed"
+ CANCELED = "Canceled"
+ CREATING = "Creating"
+ UPDATING = "Updating"
+ DELETING = "Deleting"
+
+
+class ScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Scope at which the configuration will be installed."""
+
+ CLUSTER = "cluster"
+ NAMESPACE = "namespace"
+
+
+class SourceKindType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
+ """Source Kind to pull the configuration data from."""
+
+ GIT_REPOSITORY = "GitRepository"
+ BUCKET = "Bucket"
+ AZURE_BLOB = "AzureBlob"
+ OCI_REPOSITORY = "OCIRepository"
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/__init__.py
new file mode 100644
index 0000000000000..8e0f5c0793112
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/__init__.py
@@ -0,0 +1,27 @@
+# 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.
+# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._flux_configurations_operations import FluxConfigurationsOperations # type: ignore
+from ._flux_config_operation_status_operations import FluxConfigOperationStatusOperations # type: ignore
+
+from ._patch import __all__ as _patch_all
+from ._patch import *
+from ._patch import patch_sdk as _patch_sdk
+
+__all__ = [
+ "FluxConfigurationsOperations",
+ "FluxConfigOperationStatusOperations",
+]
+__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
+_patch_sdk()
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_flux_config_operation_status_operations.py
new file mode 100644
index 0000000000000..c574e20dc5225
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_flux_config_operation_status_operations.py
@@ -0,0 +1,182 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import sys
+from typing import Any, Callable, Dict, Optional, TypeVar
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ map_error,
+)
+from azure.core.pipeline import PipelineResponse
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+
+from .. import models as _models
+from ..._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_get_request(
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ operation_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"),
+ "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"),
+ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"),
+ "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"),
+ "operationId": _SERIALIZER.url("operation_id", operation_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class FluxConfigOperationStatusOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.SourceControlConfigurationClient`'s
+ :attr:`flux_config_operation_status` 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")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ operation_id: str,
+ **kwargs: Any
+ ) -> _models.OperationStatusResult:
+ """Get Async Operation status.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param operation_id: operation Id. Required.
+ :type operation_id: str
+ :return: OperationStatusResult or the result of cls(response)
+ :rtype: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.OperationStatusResult
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[_models.OperationStatusResult] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ operation_id=operation_id,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_flux_configurations_operations.py
new file mode 100644
index 0000000000000..6f4e6b91bc95e
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_flux_configurations_operations.py
@@ -0,0 +1,1096 @@
+# pylint: disable=too-many-lines
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+from io import IOBase
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
+import urllib.parse
+
+from azure.core.exceptions import (
+ ClientAuthenticationError,
+ HttpResponseError,
+ ResourceExistsError,
+ ResourceNotFoundError,
+ ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
+ map_error,
+)
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.polling import LROPoller, NoPolling, PollingMethod
+from azure.core.rest import HttpRequest, HttpResponse
+from azure.core.tracing.decorator import distributed_trace
+from azure.core.utils import case_insensitive_dict
+from azure.mgmt.core.exceptions import ARMErrorFormat
+from azure.mgmt.core.polling.arm_polling import ARMPolling
+
+from .. import models as _models
+from ..._serialization import Serializer
+
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
+T = TypeVar("T")
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+_SERIALIZER = Serializer()
+_SERIALIZER.client_side_validation = False
+
+
+def build_get_request(
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"),
+ "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"),
+ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"),
+ "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_create_or_update_request(
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"),
+ "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"),
+ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"),
+ "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_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,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ subscription_id: str,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01-preview"))
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"),
+ "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"),
+ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"),
+ "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ if content_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,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ subscription_id: str,
+ *,
+ force_delete: Optional[bool] = None,
+ **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"),
+ "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"),
+ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"),
+ "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+ if force_delete is not None:
+ _params["forceDelete"] = _SERIALIZER.query("force_delete", force_delete, "bool")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+def build_list_request(
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01-preview"))
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = kwargs.pop(
+ "template_url",
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations",
+ ) # pylint: disable=line-too-long
+ path_format_arguments = {
+ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
+ "resourceGroupName": _SERIALIZER.url(
+ "resource_group_name", resource_group_name, "str", max_length=90, min_length=1
+ ),
+ "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, "str"),
+ "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, "str"),
+ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
+
+
+class FluxConfigurationsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.SourceControlConfigurationClient`'s
+ :attr:`flux_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")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
+
+ @distributed_trace
+ def get(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ **kwargs: Any
+ ) -> _models.FluxConfiguration:
+ """Gets details of the Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :return: FluxConfiguration or the result of cls(response)
+ :rtype: ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+
+ _request = build_get_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ def _create_or_update_initial(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(flux_configuration, (IOBase, bytes)):
+ _content = flux_configuration
+ else:
+ _json = self._serialize.body(flux_configuration, "FluxConfiguration")
+
+ _request = build_create_or_update_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: _models.FluxConfiguration,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.FluxConfiguration]:
+ """Create a new Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
+ :type flux_configuration:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.FluxConfiguration]:
+ """Create a new Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration: Properties necessary to Create a FluxConfiguration. Required.
+ :type flux_configuration: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def begin_create_or_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration: Union[_models.FluxConfiguration, IO[bytes]],
+ **kwargs: Any
+ ) -> LROPoller[_models.FluxConfiguration]:
+ """Create a new Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration: Properties necessary to Create a FluxConfiguration. Is either a
+ FluxConfiguration type or a IO[bytes] type. Required.
+ :type flux_configuration:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration or IO[bytes]
+ :return: An instance of LROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._create_or_update_initial(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ flux_configuration=flux_configuration,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ def _update_initial(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(flux_configuration_patch, (IOBase, bytes)):
+ _content = flux_configuration_patch
+ else:
+ _json = self._serialize.body(flux_configuration_patch, "FluxConfigurationPatch")
+
+ _request = build_update_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @overload
+ def begin_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: _models.FluxConfigurationPatch,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.FluxConfiguration]:
+ """Update an existing Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
+ Required.
+ :type flux_configuration_patch:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfigurationPatch
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @overload
+ def begin_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> LROPoller[_models.FluxConfiguration]:
+ """Update an existing Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration.
+ Required.
+ :type flux_configuration_patch: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: An instance of LROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+
+ @distributed_trace
+ def begin_update(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ flux_configuration_patch: Union[_models.FluxConfigurationPatch, IO[bytes]],
+ **kwargs: Any
+ ) -> LROPoller[_models.FluxConfiguration]:
+ """Update an existing Kubernetes Flux Configuration.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. Is
+ either a FluxConfigurationPatch type or a IO[bytes] type. Required.
+ :type flux_configuration_patch:
+ ~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfigurationPatch or
+ IO[bytes]
+ :return: An instance of LROPoller that returns either FluxConfiguration or the result of
+ cls(response)
+ :rtype:
+ ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
+ cls: ClsType[_models.FluxConfiguration] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._update_initial(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ flux_configuration_patch=flux_configuration_patch,
+ api_version=api_version,
+ content_type=content_type,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response):
+ deserialized = self._deserialize("FluxConfiguration", pipeline_response.http_response)
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+ return deserialized
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[_models.FluxConfiguration].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[_models.FluxConfiguration](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
+
+ def _delete_initial(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ force_delete: Optional[bool] = None,
+ **kwargs: Any
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
+
+ _request = build_delete_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ subscription_id=self._config.subscription_id,
+ force_delete=force_delete,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {}) # type: ignore
+
+ return deserialized # type: ignore
+
+ @distributed_trace
+ def begin_delete(
+ self,
+ resource_group_name: str,
+ cluster_rp: str,
+ cluster_resource_name: str,
+ cluster_name: str,
+ flux_configuration_name: str,
+ force_delete: Optional[bool] = None,
+ **kwargs: Any
+ ) -> LROPoller[None]:
+ """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync
+ from the source repo.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :param flux_configuration_name: Name of the Flux Configuration. Required.
+ :type flux_configuration_name: str
+ :param force_delete: Delete the extension resource in Azure - not the normal asynchronous
+ delete. Default value is None.
+ :type force_delete: bool
+ :return: An instance of LROPoller that returns either None or the result of cls(response)
+ :rtype: ~azure.core.polling.LROPoller[None]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[None] = kwargs.pop("cls", None)
+ polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
+ lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
+ cont_token: Optional[str] = kwargs.pop("continuation_token", None)
+ if cont_token is None:
+ raw_result = self._delete_initial(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ flux_configuration_name=flux_configuration_name,
+ force_delete=force_delete,
+ api_version=api_version,
+ cls=lambda x, y, z: x,
+ headers=_headers,
+ params=_params,
+ **kwargs
+ )
+ raw_result.http_response.read() # type: ignore
+ kwargs.pop("error_map", None)
+
+ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
+ if cls:
+ return cls(pipeline_response, None, {}) # type: ignore
+
+ if polling is True:
+ polling_method: PollingMethod = cast(
+ PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs)
+ )
+ elif polling is False:
+ polling_method = cast(PollingMethod, NoPolling())
+ else:
+ polling_method = polling
+ if cont_token:
+ return LROPoller[None].from_continuation_token(
+ polling_method=polling_method,
+ continuation_token=cont_token,
+ client=self._client,
+ deserialization_callback=get_long_running_output,
+ )
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
+
+ @distributed_trace
+ def list(
+ self, resource_group_name: str, cluster_rp: str, cluster_resource_name: str, cluster_name: str, **kwargs: Any
+ ) -> Iterable["_models.FluxConfiguration"]:
+ """List all Flux Configurations.
+
+ :param resource_group_name: The name of the resource group. The name is case insensitive.
+ Required.
+ :type resource_group_name: str
+ :param cluster_rp: The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
+ Microsoft.Kubernetes, Microsoft.HybridContainerService. Required.
+ :type cluster_rp: str
+ :param cluster_resource_name: The Kubernetes cluster resource name - i.e. managedClusters,
+ connectedClusters, provisionedClusters. Required.
+ :type cluster_resource_name: str
+ :param cluster_name: The name of the kubernetes cluster. Required.
+ :type cluster_name: str
+ :return: An iterator like instance of either FluxConfiguration or the result of cls(response)
+ :rtype:
+ ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2024_04_01_preview.models.FluxConfiguration]
+ :raises ~azure.core.exceptions.HttpResponseError:
+ """
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2024-04-01-preview")
+ )
+ cls: ClsType[_models.FluxConfigurationsList] = kwargs.pop("cls", None)
+
+ error_map: MutableMapping = {
+ 401: ClientAuthenticationError,
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ def prepare_request(next_link=None):
+ if not next_link:
+
+ _request = build_list_request(
+ resource_group_name=resource_group_name,
+ cluster_rp=cluster_rp,
+ cluster_resource_name=cluster_resource_name,
+ cluster_name=cluster_name,
+ subscription_id=self._config.subscription_id,
+ api_version=api_version,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ else:
+ # make call to next link with the client's api-version
+ _parsed_next_link = urllib.parse.urlparse(next_link)
+ _next_request_params = case_insensitive_dict(
+ {
+ key: [urllib.parse.quote(v) for v in value]
+ for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
+ }
+ )
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
+ "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
+ )
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize("FluxConfigurationsList", pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem) # type: ignore
+ return deserialized.next_link or None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ _request = prepare_request(next_link)
+
+ _stream = False
+ pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
+ raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
+
+ return pipeline_response
+
+ return ItemPaged(get_next, extract_data)
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/operations/_patch.py
new file mode 100644
index 0000000000000..f7dd32510333d
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/py.typed b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/py.typed
new file mode 100644
index 0000000000000..e5aff4f83af86
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2024_04_01_preview/py.typed
@@ -0,0 +1 @@
+# Marker file for PEP 561.
\ No newline at end of file
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension.py
index 5f3dcd660fed2..9a9daa6d9b971 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
@@ -41,7 +42,7 @@ def main():
"configurationProtectedSettings": {"omsagent.secret.key": "secretKeyValue01"},
"configurationSettings": {
"omsagent.env.clusterName": "clusterName1",
- "omsagent.secret.wsid": "omsagent.secret.wsid",
+ "omsagent.secret.wsid": "fakeTokenPlaceholder",
},
"extensionType": "azuremonitor-containers",
"releaseTrain": "Preview",
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension_with_plan.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension_with_plan.py
index 55b83368f03f4..c271aca65ef04 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension_with_plan.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_extension_with_plan.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration.py
index 88231d8cf7248..2b23b875fb6f3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration_with_bucket.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration_with_bucket.py
index d99dcc801c657..7022ca31072cb 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration_with_bucket.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_flux_configuration_with_bucket.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_source_control_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_source_control_configuration.py
index 14bb6d8531d8d..c06aec064c900 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_source_control_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/create_source_control_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_extension.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_extension.py
index 0fff15d97e275..96e42aa34b9b5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_extension.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_extension.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_flux_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_flux_configuration.py
index 94abdd4817ca0..f7836fa48f578 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_flux_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_flux_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_source_control_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_source_control_configuration.py
index 63e48d46fa3f2..c4d8beb2086c9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_source_control_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/delete_source_control_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension.py
index 682a81cb5f94b..deb962e4fdc05 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_async_operation_status.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_async_operation_status.py
index 8afa73f3e7036..52d71b9232f40 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_async_operation_status.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_async_operation_status.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_with_plan.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_with_plan.py
index 2bd80204f3de1..e28f8b5b7e3ed 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_with_plan.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_extension_with_plan.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration.py
index 3264da91ac61e..38f1a97f1af62 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration_async_operation_status.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration_async_operation_status.py
index f5c4eed29efbe..247ab2c52d7b3 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration_async_operation_status.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_flux_configuration_async_operation_status.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_source_control_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_source_control_configuration.py
index f2ac2afa31f3b..387716befd84d 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_source_control_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/get_source_control_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_async_operation_status.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_async_operation_status.py
index 4dac2b2bac3d5..fbddca1a515b5 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_async_operation_status.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_async_operation_status.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_extensions.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_extensions.py
index 8b7df0c723c98..8e497693f1e7f 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_extensions.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_extensions.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_flux_configurations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_flux_configurations.py
index da8112bb3043a..374c138b571d6 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_flux_configurations.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_flux_configurations.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_source_control_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_source_control_configuration.py
index 8b124b35b0557..e48a243cf99e9 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_source_control_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/list_source_control_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/operations_list.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/operations_list.py
index 24420b014ec1e..474cdcba0c5ed 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/operations_list.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/operations_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_extension.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_extension.py
index addc9be919e58..b35a8de9f01d7 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_extension.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_extension.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
@@ -41,7 +42,7 @@ def main():
"configurationProtectedSettings": {"omsagent.secret.key": "secretKeyValue01"},
"configurationSettings": {
"omsagent.env.clusterName": "clusterName1",
- "omsagent.secret.wsid": "omsagent.secret.wsid",
+ "omsagent.secret.wsid": "fakeTokenPlaceholder",
},
"releaseTrain": "Preview",
}
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_flux_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_flux_configuration.py
index 485217a41ffb9..c5aa5ad5fee61 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_flux_configuration.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_samples/patch_flux_configuration.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
"""
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/conftest.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/conftest.py
new file mode 100644
index 0000000000000..e054c59c4eded
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/conftest.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import os
+import pytest
+from dotenv import load_dotenv
+from devtools_testutils import (
+ test_proxy,
+ add_general_regex_sanitizer,
+ add_body_key_sanitizer,
+ add_header_regex_sanitizer,
+)
+
+load_dotenv()
+
+
+# For security, please avoid record sensitive identity information in recordings
+@pytest.fixture(scope="session", autouse=True)
+def add_sanitizers(test_proxy):
+ sourcecontrolconfiguration_subscription_id = os.environ.get(
+ "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
+ )
+ sourcecontrolconfiguration_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
+ sourcecontrolconfiguration_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
+ sourcecontrolconfiguration_client_secret = os.environ.get(
+ "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=sourcecontrolconfiguration_subscription_id, value="00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=sourcecontrolconfiguration_tenant_id, value="00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=sourcecontrolconfiguration_client_id, value="00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=sourcecontrolconfiguration_client_secret, value="00000000-0000-0000-0000-000000000000"
+ )
+
+ add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
+ add_header_regex_sanitizer(key="Cookie", value="cookie;")
+ add_body_key_sanitizer(json_path="$..access_token", value="access_token")
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_extensions_operations.py
new file mode 100644
index 0000000000000..68f5dbee5cc57
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_extensions_operations.py
@@ -0,0 +1,138 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationExtensionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_extensions_begin_create(self, resource_group):
+ response = self.client.extensions.begin_create(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ extension={
+ "aksAssignedIdentity": {"principalId": "str", "tenantId": "str", "type": "str"},
+ "autoUpgradeMinorVersion": True,
+ "configurationProtectedSettings": {"str": "str"},
+ "configurationSettings": {"str": "str"},
+ "currentVersion": "str",
+ "customLocationSettings": {"str": "str"},
+ "errorInfo": {
+ "additionalInfo": [{"info": {}, "type": "str"}],
+ "code": "str",
+ "details": [...],
+ "message": "str",
+ "target": "str",
+ },
+ "extensionType": "str",
+ "id": "str",
+ "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"},
+ "isSystemExtension": False,
+ "name": "str",
+ "packageUri": "str",
+ "plan": {"name": "str", "product": "str", "publisher": "str", "promotionCode": "str", "version": "str"},
+ "provisioningState": "str",
+ "releaseTrain": "Stable",
+ "scope": {"cluster": {"releaseNamespace": "str"}, "namespace": {"targetNamespace": "str"}},
+ "statuses": [
+ {"code": "str", "displayStatus": "str", "level": "Information", "message": "str", "time": "str"}
+ ],
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ "version": "str",
+ },
+ api_version="2023-05-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_extensions_get(self, resource_group):
+ response = self.client.extensions.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_extensions_begin_delete(self, resource_group):
+ response = self.client.extensions.begin_delete(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ api_version="2023-05-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_extensions_begin_update(self, resource_group):
+ response = self.client.extensions.begin_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ patch_extension={
+ "autoUpgradeMinorVersion": True,
+ "configurationProtectedSettings": {"str": "str"},
+ "configurationSettings": {"str": "str"},
+ "releaseTrain": "Stable",
+ "version": "str",
+ },
+ api_version="2023-05-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_extensions_list(self, resource_group):
+ response = self.client.extensions.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_extensions_operations_async.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_extensions_operations_async.py
new file mode 100644
index 0000000000000..ec311833ad14f
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_extensions_operations_async.py
@@ -0,0 +1,151 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration.aio import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationExtensionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_extensions_begin_create(self, resource_group):
+ response = await (
+ await self.client.extensions.begin_create(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ extension={
+ "aksAssignedIdentity": {"principalId": "str", "tenantId": "str", "type": "str"},
+ "autoUpgradeMinorVersion": True,
+ "configurationProtectedSettings": {"str": "str"},
+ "configurationSettings": {"str": "str"},
+ "currentVersion": "str",
+ "customLocationSettings": {"str": "str"},
+ "errorInfo": {
+ "additionalInfo": [{"info": {}, "type": "str"}],
+ "code": "str",
+ "details": [...],
+ "message": "str",
+ "target": "str",
+ },
+ "extensionType": "str",
+ "id": "str",
+ "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"},
+ "isSystemExtension": False,
+ "name": "str",
+ "packageUri": "str",
+ "plan": {
+ "name": "str",
+ "product": "str",
+ "publisher": "str",
+ "promotionCode": "str",
+ "version": "str",
+ },
+ "provisioningState": "str",
+ "releaseTrain": "Stable",
+ "scope": {"cluster": {"releaseNamespace": "str"}, "namespace": {"targetNamespace": "str"}},
+ "statuses": [
+ {"code": "str", "displayStatus": "str", "level": "Information", "message": "str", "time": "str"}
+ ],
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ "version": "str",
+ },
+ api_version="2023-05-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_extensions_get(self, resource_group):
+ response = await self.client.extensions.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_extensions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.extensions.begin_delete(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ api_version="2023-05-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_extensions_begin_update(self, resource_group):
+ response = await (
+ await self.client.extensions.begin_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ patch_extension={
+ "autoUpgradeMinorVersion": True,
+ "configurationProtectedSettings": {"str": "str"},
+ "configurationSettings": {"str": "str"},
+ "releaseTrain": "Stable",
+ "version": "str",
+ },
+ api_version="2023-05-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_extensions_list(self, resource_group):
+ response = self.client.extensions.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_config_operation_status_operations.py
new file mode 100644
index 0000000000000..81aac9809d6c0
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_config_operation_status_operations.py
@@ -0,0 +1,35 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationFluxConfigOperationStatusOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_flux_config_operation_status_get(self, resource_group):
+ response = self.client.flux_config_operation_status.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ operation_id="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_config_operation_status_operations_async.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_config_operation_status_operations_async.py
new file mode 100644
index 0000000000000..0ef96b3e5ebe2
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_config_operation_status_operations_async.py
@@ -0,0 +1,36 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration.aio import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationFluxConfigOperationStatusOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_flux_config_operation_status_get(self, resource_group):
+ response = await self.client.flux_config_operation_status.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ operation_id="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_configurations_operations.py
new file mode 100644
index 0000000000000..5c9f835eb671f
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_configurations_operations.py
@@ -0,0 +1,257 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationFluxConfigurationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_flux_configurations_get(self, resource_group):
+ response = self.client.flux_configurations.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_flux_configurations_begin_create_or_update(self, resource_group):
+ response = self.client.flux_configurations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ flux_configuration={
+ "azureBlob": {
+ "accountKey": "str",
+ "containerName": "str",
+ "localAuthRef": "str",
+ "managedIdentity": {"clientId": "str"},
+ "sasToken": "str",
+ "servicePrincipal": {
+ "clientCertificate": "str",
+ "clientCertificatePassword": "str",
+ "clientCertificateSendChain": False,
+ "clientId": "str",
+ "clientSecret": "str",
+ "tenantId": "str",
+ },
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "url": "str",
+ },
+ "bucket": {
+ "accessKey": "str",
+ "bucketName": "str",
+ "insecure": True,
+ "localAuthRef": "str",
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "url": "str",
+ },
+ "complianceState": "Unknown",
+ "configurationProtectedSettings": {"str": "str"},
+ "errorMessage": "str",
+ "gitRepository": {
+ "httpsCACert": "str",
+ "httpsUser": "str",
+ "localAuthRef": "str",
+ "repositoryRef": {"branch": "str", "commit": "str", "semver": "str", "tag": "str"},
+ "sshKnownHosts": "str",
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "url": "str",
+ },
+ "id": "str",
+ "kustomizations": {
+ "str": {
+ "dependsOn": ["str"],
+ "force": False,
+ "name": "str",
+ "path": "",
+ "postBuild": {
+ "substitute": {"str": "str"},
+ "substituteFrom": [{"kind": "str", "name": "str", "optional": False}],
+ },
+ "prune": False,
+ "retryIntervalInSeconds": 0,
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "wait": True,
+ }
+ },
+ "name": "str",
+ "namespace": "default",
+ "provisioningState": "str",
+ "reconciliationWaitDuration": "str",
+ "repositoryPublicKey": "str",
+ "scope": "cluster",
+ "sourceKind": "str",
+ "sourceSyncedCommitId": "str",
+ "sourceUpdatedAt": "2020-02-20 00:00:00",
+ "statusUpdatedAt": "2020-02-20 00:00:00",
+ "statuses": [
+ {
+ "appliedBy": {"name": "str", "namespace": "str"},
+ "complianceState": "Unknown",
+ "helmReleaseProperties": {
+ "failureCount": 0,
+ "helmChartRef": {"name": "str", "namespace": "str"},
+ "installFailureCount": 0,
+ "lastRevisionApplied": 0,
+ "upgradeFailureCount": 0,
+ },
+ "kind": "str",
+ "name": "str",
+ "namespace": "str",
+ "statusConditions": [
+ {
+ "lastTransitionTime": "2020-02-20 00:00:00",
+ "message": "str",
+ "reason": "str",
+ "status": "str",
+ "type": "str",
+ }
+ ],
+ }
+ ],
+ "suspend": False,
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ "waitForReconciliation": bool,
+ },
+ api_version="2023-05-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_flux_configurations_begin_update(self, resource_group):
+ response = self.client.flux_configurations.begin_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ flux_configuration_patch={
+ "azureBlob": {
+ "accountKey": "str",
+ "containerName": "str",
+ "localAuthRef": "str",
+ "managedIdentity": {"clientId": "str"},
+ "sasToken": "str",
+ "servicePrincipal": {
+ "clientCertificate": "str",
+ "clientCertificatePassword": "str",
+ "clientCertificateSendChain": bool,
+ "clientId": "str",
+ "clientSecret": "str",
+ "tenantId": "str",
+ },
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "url": "str",
+ },
+ "bucket": {
+ "accessKey": "str",
+ "bucketName": "str",
+ "insecure": bool,
+ "localAuthRef": "str",
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "url": "str",
+ },
+ "configurationProtectedSettings": {"str": "str"},
+ "gitRepository": {
+ "httpsCACert": "str",
+ "httpsUser": "str",
+ "localAuthRef": "str",
+ "repositoryRef": {"branch": "str", "commit": "str", "semver": "str", "tag": "str"},
+ "sshKnownHosts": "str",
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "url": "str",
+ },
+ "kustomizations": {
+ "str": {
+ "dependsOn": ["str"],
+ "force": bool,
+ "path": "str",
+ "postBuild": {
+ "substitute": {"str": "str"},
+ "substituteFrom": [{"kind": "str", "name": "str", "optional": False}],
+ },
+ "prune": bool,
+ "retryIntervalInSeconds": 0,
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "wait": bool,
+ }
+ },
+ "sourceKind": "str",
+ "suspend": bool,
+ },
+ api_version="2023-05-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_flux_configurations_begin_delete(self, resource_group):
+ response = self.client.flux_configurations.begin_delete(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ api_version="2023-05-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_flux_configurations_list(self, resource_group):
+ response = self.client.flux_configurations.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_configurations_operations_async.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_configurations_operations_async.py
new file mode 100644
index 0000000000000..454ef08d04b72
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_flux_configurations_operations_async.py
@@ -0,0 +1,264 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration.aio import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationFluxConfigurationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_flux_configurations_get(self, resource_group):
+ response = await self.client.flux_configurations.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_flux_configurations_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.flux_configurations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ flux_configuration={
+ "azureBlob": {
+ "accountKey": "str",
+ "containerName": "str",
+ "localAuthRef": "str",
+ "managedIdentity": {"clientId": "str"},
+ "sasToken": "str",
+ "servicePrincipal": {
+ "clientCertificate": "str",
+ "clientCertificatePassword": "str",
+ "clientCertificateSendChain": False,
+ "clientId": "str",
+ "clientSecret": "str",
+ "tenantId": "str",
+ },
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "url": "str",
+ },
+ "bucket": {
+ "accessKey": "str",
+ "bucketName": "str",
+ "insecure": True,
+ "localAuthRef": "str",
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "url": "str",
+ },
+ "complianceState": "Unknown",
+ "configurationProtectedSettings": {"str": "str"},
+ "errorMessage": "str",
+ "gitRepository": {
+ "httpsCACert": "str",
+ "httpsUser": "str",
+ "localAuthRef": "str",
+ "repositoryRef": {"branch": "str", "commit": "str", "semver": "str", "tag": "str"},
+ "sshKnownHosts": "str",
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "url": "str",
+ },
+ "id": "str",
+ "kustomizations": {
+ "str": {
+ "dependsOn": ["str"],
+ "force": False,
+ "name": "str",
+ "path": "",
+ "postBuild": {
+ "substitute": {"str": "str"},
+ "substituteFrom": [{"kind": "str", "name": "str", "optional": False}],
+ },
+ "prune": False,
+ "retryIntervalInSeconds": 0,
+ "syncIntervalInSeconds": 600,
+ "timeoutInSeconds": 600,
+ "wait": True,
+ }
+ },
+ "name": "str",
+ "namespace": "default",
+ "provisioningState": "str",
+ "reconciliationWaitDuration": "str",
+ "repositoryPublicKey": "str",
+ "scope": "cluster",
+ "sourceKind": "str",
+ "sourceSyncedCommitId": "str",
+ "sourceUpdatedAt": "2020-02-20 00:00:00",
+ "statusUpdatedAt": "2020-02-20 00:00:00",
+ "statuses": [
+ {
+ "appliedBy": {"name": "str", "namespace": "str"},
+ "complianceState": "Unknown",
+ "helmReleaseProperties": {
+ "failureCount": 0,
+ "helmChartRef": {"name": "str", "namespace": "str"},
+ "installFailureCount": 0,
+ "lastRevisionApplied": 0,
+ "upgradeFailureCount": 0,
+ },
+ "kind": "str",
+ "name": "str",
+ "namespace": "str",
+ "statusConditions": [
+ {
+ "lastTransitionTime": "2020-02-20 00:00:00",
+ "message": "str",
+ "reason": "str",
+ "status": "str",
+ "type": "str",
+ }
+ ],
+ }
+ ],
+ "suspend": False,
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ "waitForReconciliation": bool,
+ },
+ api_version="2023-05-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_flux_configurations_begin_update(self, resource_group):
+ response = await (
+ await self.client.flux_configurations.begin_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ flux_configuration_patch={
+ "azureBlob": {
+ "accountKey": "str",
+ "containerName": "str",
+ "localAuthRef": "str",
+ "managedIdentity": {"clientId": "str"},
+ "sasToken": "str",
+ "servicePrincipal": {
+ "clientCertificate": "str",
+ "clientCertificatePassword": "str",
+ "clientCertificateSendChain": bool,
+ "clientId": "str",
+ "clientSecret": "str",
+ "tenantId": "str",
+ },
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "url": "str",
+ },
+ "bucket": {
+ "accessKey": "str",
+ "bucketName": "str",
+ "insecure": bool,
+ "localAuthRef": "str",
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "url": "str",
+ },
+ "configurationProtectedSettings": {"str": "str"},
+ "gitRepository": {
+ "httpsCACert": "str",
+ "httpsUser": "str",
+ "localAuthRef": "str",
+ "repositoryRef": {"branch": "str", "commit": "str", "semver": "str", "tag": "str"},
+ "sshKnownHosts": "str",
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "url": "str",
+ },
+ "kustomizations": {
+ "str": {
+ "dependsOn": ["str"],
+ "force": bool,
+ "path": "str",
+ "postBuild": {
+ "substitute": {"str": "str"},
+ "substituteFrom": [{"kind": "str", "name": "str", "optional": False}],
+ },
+ "prune": bool,
+ "retryIntervalInSeconds": 0,
+ "syncIntervalInSeconds": 0,
+ "timeoutInSeconds": 0,
+ "wait": bool,
+ }
+ },
+ "sourceKind": "str",
+ "suspend": bool,
+ },
+ api_version="2023-05-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_flux_configurations_begin_delete(self, resource_group):
+ response = await (
+ await self.client.flux_configurations.begin_delete(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ flux_configuration_name="str",
+ api_version="2023-05-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_flux_configurations_list(self, resource_group):
+ response = self.client.flux_configurations.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operation_status_operations.py
new file mode 100644
index 0000000000000..a85022784eb49
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operation_status_operations.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationOperationStatusOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_operation_status_get(self, resource_group):
+ response = self.client.operation_status.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ operation_id="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_operation_status_list(self, resource_group):
+ response = self.client.operation_status.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operation_status_operations_async.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operation_status_operations_async.py
new file mode 100644
index 0000000000000..c1a9bba4a6e9e
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operation_status_operations_async.py
@@ -0,0 +1,50 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration.aio import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationOperationStatusOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_operation_status_get(self, resource_group):
+ response = await self.client.operation_status.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ extension_name="str",
+ operation_id="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_operation_status_list(self, resource_group):
+ response = self.client.operation_status.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operations.py
new file mode 100644
index 0000000000000..76c582a6231a1
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operations.py
@@ -0,0 +1,29 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_operations_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2023-05-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operations_async.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operations_async.py
new file mode 100644
index 0000000000000..fa4b99c966d71
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_operations_async.py
@@ -0,0 +1,30 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration.aio import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_operations_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2023-05-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_source_control_configurations_operations.py
new file mode 100644
index 0000000000000..66047042d5c1d
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_source_control_configurations_operations.py
@@ -0,0 +1,109 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationSourceControlConfigurationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_source_control_configurations_get(self, resource_group):
+ response = self.client.source_control_configurations.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ source_control_configuration_name="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_source_control_configurations_create_or_update(self, resource_group):
+ response = self.client.source_control_configurations.create_or_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ source_control_configuration_name="str",
+ source_control_configuration={
+ "complianceStatus": {
+ "complianceState": "str",
+ "lastConfigApplied": "2020-02-20 00:00:00",
+ "message": "str",
+ "messageLevel": "str",
+ },
+ "configurationProtectedSettings": {"str": "str"},
+ "enableHelmOperator": bool,
+ "helmOperatorProperties": {"chartValues": "str", "chartVersion": "str"},
+ "id": "str",
+ "name": "str",
+ "operatorInstanceName": "str",
+ "operatorNamespace": "default",
+ "operatorParams": "str",
+ "operatorScope": "cluster",
+ "operatorType": "str",
+ "provisioningState": "str",
+ "repositoryPublicKey": "str",
+ "repositoryUrl": "str",
+ "sshKnownHostsContents": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ },
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_source_control_configurations_begin_delete(self, resource_group):
+ response = self.client.source_control_configurations.begin_delete(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ source_control_configuration_name="str",
+ api_version="2023-05-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_source_control_configurations_list(self, resource_group):
+ response = self.client.source_control_configurations.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_source_control_configurations_operations_async.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_source_control_configurations_operations_async.py
new file mode 100644
index 0000000000000..4ae3d16d1a817
--- /dev/null
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/generated_tests/test_source_control_configuration_source_control_configurations_operations_async.py
@@ -0,0 +1,112 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.kubernetesconfiguration.aio import SourceControlConfigurationClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestSourceControlConfigurationSourceControlConfigurationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(SourceControlConfigurationClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_source_control_configurations_get(self, resource_group):
+ response = await self.client.source_control_configurations.get(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ source_control_configuration_name="str",
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_source_control_configurations_create_or_update(self, resource_group):
+ response = await self.client.source_control_configurations.create_or_update(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ source_control_configuration_name="str",
+ source_control_configuration={
+ "complianceStatus": {
+ "complianceState": "str",
+ "lastConfigApplied": "2020-02-20 00:00:00",
+ "message": "str",
+ "messageLevel": "str",
+ },
+ "configurationProtectedSettings": {"str": "str"},
+ "enableHelmOperator": bool,
+ "helmOperatorProperties": {"chartValues": "str", "chartVersion": "str"},
+ "id": "str",
+ "name": "str",
+ "operatorInstanceName": "str",
+ "operatorNamespace": "default",
+ "operatorParams": "str",
+ "operatorScope": "cluster",
+ "operatorType": "str",
+ "provisioningState": "str",
+ "repositoryPublicKey": "str",
+ "repositoryUrl": "str",
+ "sshKnownHostsContents": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "type": "str",
+ },
+ api_version="2023-05-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_source_control_configurations_begin_delete(self, resource_group):
+ response = await (
+ await self.client.source_control_configurations.begin_delete(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ source_control_configuration_name="str",
+ api_version="2023-05-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_source_control_configurations_list(self, resource_group):
+ response = self.client.source_control_configurations.list(
+ resource_group_name=resource_group.name,
+ cluster_rp="str",
+ cluster_resource_name="str",
+ cluster_name="str",
+ api_version="2023-05-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/setup.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/setup.py
index a15a937f2162d..b5c074af4c5ce 100644
--- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/setup.py
+++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/setup.py
@@ -53,11 +53,11 @@
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
@@ -74,10 +74,10 @@
"pytyped": ["py.typed"],
},
install_requires=[
- "isodate<1.0.0,>=0.6.1",
- "azure-common~=1.1",
- "azure-mgmt-core>=1.3.2,<2.0.0",
- "typing-extensions>=4.3.0; python_version<'3.8.0'",
+ "isodate>=0.6.1",
+ "typing-extensions>=4.6.0",
+ "azure-common>=1.1",
+ "azure-mgmt-core>=1.3.2",
],
- python_requires=">=3.7",
+ python_requires=">=3.8",
)