diff --git a/sdk/authorization/azure-mgmt-authorization/README.md b/sdk/authorization/azure-mgmt-authorization/README.md
index ee0db8650f6a..a4dc9ba62af9 100644
--- a/sdk/authorization/azure-mgmt-authorization/README.md
+++ b/sdk/authorization/azure-mgmt-authorization/README.md
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Python
This is the Microsoft Azure Authorization 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.
-
-
-
diff --git a/sdk/authorization/azure-mgmt-authorization/_meta.json b/sdk/authorization/azure-mgmt-authorization/_meta.json
index ca36520af982..c647d5737293 100644
--- a/sdk/authorization/azure-mgmt-authorization/_meta.json
+++ b/sdk/authorization/azure-mgmt-authorization/_meta.json
@@ -1,11 +1,11 @@
{
- "commit": "1af2861030243b06ee35172c95899f4809eedfc7",
+ "commit": "a51cd6fc2a6951290680e1d8bb0b20b92507e71d",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
- "autorest": "3.9.2",
+ "autorest": "3.10.2",
"use": [
- "@autorest/python@6.6.0",
- "@autorest/modelerfour@4.24.3"
+ "@autorest/python@6.27.4",
+ "@autorest/modelerfour@4.27.0"
],
- "autorest_command": "autorest specification/authorization/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.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
+ "autorest_command": "autorest specification/authorization/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.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/authorization/resource-manager/readme.md"
}
\ No newline at end of file
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py
index 381d561b2425..41454a937ee9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_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
@@ -117,7 +120,25 @@ def __init__(
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = AuthorizationManagementClientConfiguration(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 = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
super(AuthorizationManagementClient, self).__init__(
api_version=api_version,
profile=profile
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_configuration.py
index f52b9ee54234..da56a57b0cd1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_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 AuthorizationManagementClientConfiguration(Configuration):
+class AuthorizationManagementClientConfiguration:
"""Configuration for AuthorizationManagementClient.
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(AuthorizationManagementClientConfiguration, 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-authorization/{}'.format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py
index e3cc6ce6ed6f..a94487cbf17a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_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: # 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
@@ -664,23 +720,24 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
- except ValueError:
- continue
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
- 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
@@ -709,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
"""
@@ -731,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.
- :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]
- data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
- if not kwargs.get("skip_quote", False):
- data = [quote(str(d), safe="") for d in data]
- return str(self.serialize_iter(data, internal_data_type, **kwargs))
+ do_quote = not kwargs.get("skip_quote", False)
+ return 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)
@@ -764,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]"]:
@@ -785,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
@@ -825,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
@@ -846,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
@@ -876,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.
@@ -887,13 +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'.
+ Defaults to False.
:rtype: list, str
+ :return: serialized iterable
"""
if isinstance(data, str):
raise SerializationError("Refuse str type as a valid iter type.")
@@ -905,9 +965,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized.append(None)
+ if kwargs.get("do_quote", False):
+ serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
+
if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
@@ -943,16 +1008,17 @@ 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 = {}
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized[self.serialize_unicode(key)] = None
if "xml" in serialization_ctxt:
@@ -967,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
@@ -975,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
@@ -985,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)
@@ -999,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:
@@ -1030,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)
@@ -1087,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)
@@ -1101,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],
@@ -1137,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)
@@ -1162,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
@@ -1182,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
@@ -1201,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
@@ -1222,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:])
@@ -1230,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)
@@ -1277,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
@@ -1329,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:
@@ -1352,7 +1440,7 @@ def xml_key_extractor(attr, attr_desc, data):
return children[0]
-class Deserializer(object):
+class Deserializer:
"""Response object model deserializer.
:param dict classes: Class type dictionary for deserializing complex types.
@@ -1361,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,
@@ -1383,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
@@ -1401,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
@@ -1414,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)
@@ -1436,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"...
@@ -1473,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:
@@ -1503,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
@@ -1529,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
)
@@ -1550,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", {})
@@ -1570,31 +1665,42 @@ 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() # pylint: disable=protected-access # type: ignore
+ if v.get("readonly")
+ ]
+ const = [
+ k
+ for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore
+ if v.get("constant")
+ ]
kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const}
response_obj = response(**kwargs)
for attr in readonly:
setattr(response_obj, attr, attrs.get(attr))
if additional_properties:
- response_obj.additional_properties = additional_properties
+ response_obj.additional_properties = additional_properties # type: ignore
return response_obj
except TypeError as err:
msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore
- raise DeserializationError(msg + str(err))
+ raise DeserializationError(msg + str(err)) from err
else:
try:
for attr, value in attrs.items():
@@ -1603,15 +1709,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
@@ -1625,7 +1732,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)
@@ -1644,15 +1755,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:
@@ -1669,6 +1780,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):
@@ -1679,11 +1791,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.
"""
@@ -1692,7 +1805,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:
@@ -1718,11 +1831,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
@@ -1730,6 +1842,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.
"""
@@ -1741,24 +1854,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):
@@ -1766,6 +1878,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,
@@ -1779,8 +1892,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):
@@ -1792,6 +1904,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:
@@ -1800,12 +1913,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:
@@ -1821,6 +1933,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.
"""
@@ -1833,6 +1946,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.
"""
@@ -1848,22 +1962,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.
"""
@@ -1876,6 +1992,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.
"""
@@ -1885,15 +2002,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.
"""
@@ -1902,13 +2019,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.
"""
@@ -1923,6 +2041,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.
"""
@@ -1937,15 +2056,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.
"""
@@ -1974,9 +2093,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):
@@ -1984,15 +2102,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_client.py
index 030b0658dbf1..e82020330b56 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_authorization_management_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
@@ -117,7 +120,25 @@ def __init__(
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = AuthorizationManagementClientConfiguration(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 = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
super(AuthorizationManagementClient, self).__init__(
api_version=api_version,
profile=profile
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_configuration.py
index a9ce559ac2cf..53b71e9a9f2b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/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 AuthorizationManagementClientConfiguration(Configuration):
+class AuthorizationManagementClientConfiguration:
"""Configuration for AuthorizationManagementClient.
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(AuthorizationManagementClientConfiguration, 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-authorization/{}'.format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_client.py
index f12a37a96c66..42e3d4a04f92 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_authorization_management_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 ClassicAdministratorsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
definitions and role assignments. A role definition describes the set of actions that can be
@@ -52,7 +54,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -62,7 +82,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2015-06-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
@@ -82,12 +102,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_configuration.py
index c8842b7e5fa2..d8ef28b7d6f3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2015-06-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_metadata.json
index aa6ebd5cdd75..161138ba5392 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"classic_administrators": "ClassicAdministratorsOperations"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_client.py
index 79efd40a81ac..0183d6d63e5d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_authorization_management_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 ClassicAdministratorsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
definitions and role assignments. A role definition describes the set of actions that can be
@@ -52,7 +54,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -62,7 +82,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2015-06-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
@@ -82,12 +104,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_configuration.py
index b6f433c3f247..1a4d626c655f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2015-06-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/__init__.py
index eb44c2838d09..b49d39f809fe 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/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 ._classic_administrators_operations import ClassicAdministratorsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._classic_administrators_operations import ClassicAdministratorsOperations # 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__ = [
"ClassicAdministratorsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_operations.py
index 8fc7122b7b46..3e1cebf5c601 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/aio/operations/_classic_administrators_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._classic_administrators_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,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]:
"""Gets service administrator, account administrator, and co-administrators for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClassicAdministrator or the result of
cls(response)
:rtype:
@@ -70,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-01"))
cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,15 +82,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]:
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
@@ -100,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("ClassicAdministratorListResult", pipeline_response)
@@ -117,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
@@ -133,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py
index 22ce374ed7ae..e04bed2c7149 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py
@@ -5,14 +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 ._models_py3 import ClassicAdministrator
-from ._models_py3 import ClassicAdministratorListResult
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ClassicAdministrator,
+ ClassicAdministratorListResult,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+)
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__ = [
@@ -22,5 +31,5 @@
"ErrorDetail",
"ErrorResponse",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py
index 1062cba94c1a..acb631813e55 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_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.
@@ -12,7 +11,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py
index eb44c2838d09..b49d39f809fe 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/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 ._classic_administrators_operations import ClassicAdministratorsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._classic_administrators_operations import ClassicAdministratorsOperations # 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__ = [
"ClassicAdministratorsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py
index 477ad39de894..e96be8f8869b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +88,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]:
"""Gets service administrator, account administrator, and co-administrators for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClassicAdministrator or the result of
cls(response)
:rtype:
@@ -99,7 +100,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-01"))
cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -110,15 +111,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]:
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
@@ -129,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
def extract_data(pipeline_response):
deserialized = self._deserialize("ClassicAdministratorListResult", pipeline_response)
@@ -146,11 +144,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
@@ -162,5 +160,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_client.py
index aaccd7c597f8..9c3cd99bc7d5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
definitions and role assignments. A role definition describes the set of actions that can be
@@ -73,7 +75,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -98,7 +118,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2015-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
@@ -118,12 +138,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_configuration.py
index 9754fc6dc41c..d40cd6f6e9a9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2015-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_metadata.json
index a3fd15ea9150..3a65e7bbd6b1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"permissions": "PermissionsOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_client.py
index 0462fd81915f..7c77b5f565a0 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
definitions and role assignments. A role definition describes the set of actions that can be
@@ -73,7 +75,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -98,7 +118,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2015-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
@@ -118,12 +140,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_configuration.py
index 05ba4ebb00d5..20b4549a6da7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2015-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/__init__.py
index 5e4c27bb4cc7..e2b1ff1a7099 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_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 ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
-from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations
-from ._global_administrator_operations import GlobalAdministratorOperations
-from ._role_assignments_operations import RoleAssignmentsOperations
-from ._classic_administrators_operations import ClassicAdministratorsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # type: ignore
+from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations # type: ignore
+from ._global_administrator_operations import GlobalAdministratorOperations # type: ignore
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._classic_administrators_operations import ClassicAdministratorsOperations # 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 @@
"RoleAssignmentsOperations",
"ClassicAdministratorsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_operations.py
index 2ff0577ad8a4..645eadee7277 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_classic_administrators_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._classic_administrators_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,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]:
"""Gets service administrator, account administrator, and co-administrators for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClassicAdministrator or the result of
cls(response)
:rtype:
@@ -70,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,15 +82,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClassicAdministrator"]:
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
@@ -100,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("ClassicAdministratorListResult", pipeline_response)
@@ -117,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
@@ -133,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_operations.py
index 0c066f8be930..4d66be8d0449 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_global_administrator_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._global_administrator_operations import build_elevate_access_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]]
@@ -52,15 +54,14 @@ def __init__(self, *args, **kwargs) -> None:
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
- async def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
+ async def elevate_access(self, **kwargs: Any) -> None:
"""Elevates access for a Global Administrator.
- :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,
@@ -74,18 +75,16 @@ async def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=incons
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_elevate_access_request(
+ _request = build_elevate_access_request(
api_version=api_version,
- template_url=self.elevate_access.metadata["url"],
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
@@ -96,6 +95,4 @@ async def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=incons
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- elevate_access.metadata = {"url": "/providers/Microsoft.Authorization/elevateAccess"}
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_operations.py
index f7dc7c98768f..08e483798e75 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_permissions_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._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_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]]
@@ -60,7 +62,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
: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 Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission]
@@ -72,7 +73,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,16 +84,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -103,14 +102,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("PermissionGetResult", pipeline_response)
@@ -120,11 +118,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,10 +135,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -164,7 +158,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission]
@@ -176,7 +169,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +180,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -195,12 +188,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -211,14 +202,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("PermissionGetResult", pipeline_response)
@@ -228,11 +218,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
@@ -244,7 +234,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_operations.py
index 364a0a8c192c..1b639b355c14 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_provider_operations_metadata_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._provider_operations_metadata_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]]
@@ -64,12 +66,11 @@ async def get(
:type resource_provider_namespace: str
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderOperationsMetadata or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadata
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,20 +84,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_provider_namespace=resource_provider_namespace,
expand=expand,
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
@@ -106,22 +105,20 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response)
+ deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_models.ProviderOperationsMetadata"]:
+ # pylint: disable=line-too-long
"""Gets provider operations metadata for all resource providers.
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderOperationsMetadata or the result of
cls(response)
:rtype:
@@ -134,7 +131,7 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,15 +142,13 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
expand=expand,
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
@@ -164,14 +159,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("ProviderOperationsMetadataListResult", pipeline_response)
@@ -181,11 +175,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
@@ -197,5 +191,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_operations.py
index c8d93d2e80ad..9d6fcc284782 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_assignments_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._role_assignments_operations import (
build_create_by_id_request,
build_create_request,
@@ -42,6 +40,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]]
@@ -94,7 +96,6 @@ def list_for_resource(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -106,7 +107,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -117,7 +118,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -126,12 +127,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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 +141,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("RoleAssignmentListResult", pipeline_response)
@@ -159,11 +157,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
@@ -176,10 +174,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -193,7 +187,6 @@ def list_for_resource_group(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -205,7 +198,7 @@ def list_for_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -216,17 +209,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -237,14 +228,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("RoleAssignmentListResult", pipeline_response)
@@ -254,11 +244,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
@@ -271,10 +261,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace_async
async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
"""Deletes a role assignment.
@@ -283,12 +269,11 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
:type scope: str
:param role_assignment_name: The name of the role assignment to delete. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -302,20 +287,18 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -327,14 +310,12 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
async def create(
@@ -346,6 +327,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -363,7 +345,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -374,11 +355,12 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -392,11 +374,10 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -407,9 +388,10 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -423,18 +405,14 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -457,23 +435,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -483,14 +459,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("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -500,12 +474,11 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
:type scope: str
:param role_assignment_name: The name of the role assignment to get. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -519,20 +492,18 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -542,17 +513,16 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
+ # pylint: disable=line-too-long
"""Deletes a role assignment.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -561,12 +531,11 @@ async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional
/subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}.
Required.
:type role_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -580,19 +549,17 @@ async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -604,14 +571,12 @@ async def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
async def create_by_id(
@@ -622,6 +587,7 @@ async def create_by_id(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -635,7 +601,6 @@ async def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -643,8 +608,9 @@ async def create_by_id(
@overload
async def create_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -654,11 +620,10 @@ async def create_by_id(
Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -666,8 +631,12 @@ async def create_by_id(
@distributed_trace_async
async def create_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -677,18 +646,14 @@ async def create_by_id(
Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -711,22 +676,20 @@ async def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -736,17 +699,16 @@ async def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Gets a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -755,12 +717,11 @@ async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.Rol
/subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}.
Required.
:type role_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -774,19 +735,17 @@ async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.Rol
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -796,14 +755,12 @@ async def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.Rol
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleAssignment"]:
@@ -813,7 +770,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -825,7 +781,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -836,16 +792,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -856,14 +810,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("RoleAssignmentListResult", pipeline_response)
@@ -873,11 +826,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
@@ -890,8 +843,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
@@ -904,7 +855,6 @@ def list_for_scope(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -916,7 +866,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -927,16 +877,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -947,14 +895,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("RoleAssignmentListResult", pipeline_response)
@@ -964,11 +911,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
@@ -980,5 +927,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_operations.py
index e53afe0a419e..cd2a3ca6ecb3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/aio/operations/_role_definitions_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._role_definitions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -37,6 +35,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,12 +71,11 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,20 +89,18 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -113,14 +112,12 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
@@ -130,12 +127,11 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -149,20 +145,18 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -172,14 +166,12 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -202,7 +194,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -213,7 +204,7 @@ async def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -225,11 +216,10 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -237,7 +227,11 @@ async def create_or_update(
@distributed_trace_async
async def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
"""Creates or updates a role definition.
@@ -246,17 +240,13 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
- :type role_definition: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ a IO[bytes] type. Required.
+ :type role_definition: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -279,23 +269,21 @@ async def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -305,14 +293,12 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]:
@@ -323,7 +309,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition]
@@ -335,7 +320,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -346,16 +331,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -366,14 +349,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("RoleDefinitionListResult", pipeline_response)
@@ -383,11 +365,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
@@ -400,8 +382,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace_async
async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -412,12 +392,11 @@ async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.Rol
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -431,19 +410,17 @@ async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.Rol
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_definition_id=role_definition_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -453,11 +430,9 @@ async def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.Rol
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleDefinitionId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py
index 476bc48f5b50..1c983f30ab21 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py
@@ -5,29 +5,38 @@
# 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 ClassicAdministrator
-from ._models_py3 import ClassicAdministratorListResult
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Permission
-from ._models_py3 import PermissionGetResult
-from ._models_py3 import ProviderOperation
-from ._models_py3 import ProviderOperationsMetadata
-from ._models_py3 import ProviderOperationsMetadataListResult
-from ._models_py3 import ResourceType
-from ._models_py3 import RoleAssignment
-from ._models_py3 import RoleAssignmentCreateParameters
-from ._models_py3 import RoleAssignmentFilter
-from ._models_py3 import RoleAssignmentListResult
-from ._models_py3 import RoleAssignmentProperties
-from ._models_py3 import RoleAssignmentPropertiesWithScope
-from ._models_py3 import RoleDefinition
-from ._models_py3 import RoleDefinitionFilter
-from ._models_py3 import RoleDefinitionListResult
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ClassicAdministrator,
+ ClassicAdministratorListResult,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Permission,
+ PermissionGetResult,
+ ProviderOperation,
+ ProviderOperationsMetadata,
+ ProviderOperationsMetadataListResult,
+ ResourceType,
+ RoleAssignment,
+ RoleAssignmentCreateParameters,
+ RoleAssignmentFilter,
+ RoleAssignmentListResult,
+ RoleAssignmentProperties,
+ RoleAssignmentPropertiesWithScope,
+ RoleDefinition,
+ RoleDefinitionFilter,
+ RoleDefinitionListResult,
+)
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__ = [
@@ -52,5 +61,5 @@
"RoleDefinitionFilter",
"RoleDefinitionListResult",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py
index 6cb02fbd54fe..3c9f9897e4d7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_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.
@@ -15,10 +14,9 @@
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
- from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
@@ -488,7 +486,7 @@ def __init__(
class RoleAssignmentCreateParameters(_serialization.Model):
"""Role assignment create parameters.
- 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 properties: Role assignment properties. Required.
:vartype properties: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentProperties
@@ -562,7 +560,7 @@ def __init__(
class RoleAssignmentProperties(_serialization.Model):
"""Role assignment properties.
- 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 role_definition_id: The role definition ID used in the role assignment. Required.
:vartype role_definition_id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py
index 5e4c27bb4cc7..e2b1ff1a7099 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_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 ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
-from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations
-from ._global_administrator_operations import GlobalAdministratorOperations
-from ._role_assignments_operations import RoleAssignmentsOperations
-from ._classic_administrators_operations import ClassicAdministratorsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # type: ignore
+from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations # type: ignore
+from ._global_administrator_operations import GlobalAdministratorOperations # type: ignore
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._classic_administrators_operations import ClassicAdministratorsOperations # 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 @@
"RoleAssignmentsOperations",
"ClassicAdministratorsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py
index 2723b964e405..7b037cb9ea41 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +88,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]:
"""Gets service administrator, account administrator, and co-administrators for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ClassicAdministrator or the result of
cls(response)
:rtype:
@@ -99,7 +100,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.ClassicAdministratorListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -110,15 +111,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClassicAdministrator"]:
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
@@ -129,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
def extract_data(pipeline_response):
deserialized = self._deserialize("ClassicAdministratorListResult", pipeline_response)
@@ -146,11 +144,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
@@ -162,5 +160,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py
index 44e2996b346a..e17e5726caed 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_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]]
@@ -77,12 +79,11 @@ def __init__(self, *args, **kwargs):
def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
"""Elevates access for a Global Administrator.
- :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,
@@ -96,18 +97,16 @@ def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=inconsistent
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_elevate_access_request(
+ _request = build_elevate_access_request(
api_version=api_version,
- template_url=self.elevate_access.metadata["url"],
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
@@ -118,6 +117,4 @@ def elevate_access(self, **kwargs: Any) -> None: # pylint: disable=inconsistent
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- elevate_access.metadata = {"url": "/providers/Microsoft.Authorization/elevateAccess"}
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py
index 947f26d65d70..6bfdff71361f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -97,7 +99,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -135,7 +137,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
: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 Permission or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -146,7 +147,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -157,16 +158,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -177,14 +176,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("PermissionGetResult", pipeline_response)
@@ -194,11 +192,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
@@ -211,10 +209,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -238,7 +232,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -249,7 +242,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -260,7 +253,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -268,12 +261,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -284,14 +275,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("PermissionGetResult", pipeline_response)
@@ -301,11 +291,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
@@ -317,7 +307,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py
index 227deda6a6df..73d0792ab993 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour
"resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -115,12 +117,11 @@ def get(
:type resource_provider_namespace: str
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderOperationsMetadata or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadata
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -134,20 +135,18 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_provider_namespace=resource_provider_namespace,
expand=expand,
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
@@ -157,14 +156,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response)
+ deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_models.ProviderOperationsMetadata"]:
@@ -172,7 +169,6 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderOperationsMetadata or the result of
cls(response)
:rtype:
@@ -185,7 +181,7 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -196,15 +192,13 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
expand=expand,
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
@@ -215,14 +209,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("ProviderOperationsMetadataListResult", pipeline_response)
@@ -232,11 +225,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,5 +241,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py
index f84bbdb3cb5c..0d7b94fba521 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py
@@ -7,6 +7,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 +21,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, _format_url_section
+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]]
@@ -70,7 +73,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -104,7 +107,7 @@ def build_list_for_resource_group_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -131,7 +134,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -157,7 +160,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -184,7 +187,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -208,7 +211,7 @@ def build_delete_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -233,7 +236,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -259,7 +262,7 @@ def build_get_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpReque
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -285,7 +288,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -311,7 +314,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -372,7 +375,6 @@ def list_for_resource(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -384,7 +386,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -395,7 +397,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -404,12 +406,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -420,14 +420,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("RoleAssignmentListResult", pipeline_response)
@@ -437,11 +436,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
@@ -454,10 +453,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -471,7 +466,6 @@ def list_for_resource_group(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -483,7 +477,7 @@ def list_for_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -494,17 +488,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -515,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
def extract_data(pipeline_response):
deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response)
@@ -532,11 +523,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
@@ -549,10 +540,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
"""Deletes a role assignment.
@@ -561,12 +548,11 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
:type scope: str
:param role_assignment_name: The name of the role assignment to delete. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -580,20 +566,18 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -605,14 +589,12 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
def create(
@@ -624,6 +606,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -641,7 +624,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -652,11 +634,12 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -670,11 +653,10 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -685,9 +667,10 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -701,18 +684,14 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -735,23 +714,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -761,14 +738,12 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -778,12 +753,11 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
:type scope: str
:param role_assignment_name: The name of the role assignment to get. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -797,20 +771,18 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -820,17 +792,16 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
+ # pylint: disable=line-too-long
"""Deletes a role assignment.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -839,12 +810,11 @@ def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_mode
/subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}.
Required.
:type role_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -858,19 +828,17 @@ def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_mode
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -882,14 +850,12 @@ def delete_by_id(self, role_assignment_id: str, **kwargs: Any) -> Optional[_mode
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
def create_by_id(
@@ -900,6 +866,7 @@ def create_by_id(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -913,7 +880,6 @@ def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -921,8 +887,9 @@ def create_by_id(
@overload
def create_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -932,11 +899,10 @@ def create_by_id(
Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -944,8 +910,12 @@ def create_by_id(
@distributed_trace
def create_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -955,18 +925,14 @@ def create_by_id(
Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -989,22 +955,20 @@ def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -1014,17 +978,16 @@ def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Gets a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment, including the scope,
@@ -1033,12 +996,11 @@ def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssig
/subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}.
Required.
:type role_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1052,19 +1014,17 @@ def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssig
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -1074,14 +1034,12 @@ def get_by_id(self, role_assignment_id: str, **kwargs: Any) -> _models.RoleAssig
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleAssignment"]:
@@ -1091,7 +1049,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -1103,7 +1060,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1114,16 +1071,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -1134,14 +1089,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("RoleAssignmentListResult", pipeline_response)
@@ -1151,11 +1105,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
@@ -1168,8 +1122,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
@@ -1182,7 +1134,6 @@ def list_for_scope(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment]
@@ -1194,7 +1145,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1205,16 +1156,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -1225,14 +1174,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("RoleAssignmentListResult", pipeline_response)
@@ -1242,11 +1190,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
@@ -1258,5 +1206,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py
index 209215e725ac..6c3335492bd3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) ->
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,7 +78,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -102,7 +104,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -128,7 +130,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -154,7 +156,7 @@ def build_get_by_id_request(role_definition_id: str, **kwargs: Any) -> HttpReque
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -193,12 +195,11 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,20 +213,18 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -237,14 +236,12 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
@@ -254,12 +251,11 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -273,20 +269,18 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -296,14 +290,12 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -326,7 +318,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -337,7 +328,7 @@ def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -349,11 +340,10 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -361,7 +351,11 @@ def create_or_update(
@distributed_trace
def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
"""Creates or updates a role definition.
@@ -370,17 +364,13 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
- :type role_definition: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ a IO[bytes] type. Required.
+ :type role_definition: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -403,23 +393,21 @@ def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -429,14 +417,12 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]:
@@ -447,7 +433,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition]
@@ -459,7 +444,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -470,16 +455,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -490,14 +473,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("RoleDefinitionListResult", pipeline_response)
@@ -507,11 +489,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
@@ -524,8 +506,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace
def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -536,12 +516,11 @@ def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefin
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -555,19 +534,17 @@ def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefin
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-07-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_definition_id=role_definition_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -577,11 +554,9 @@ def get_by_id(self, role_definition_id: str, **kwargs: Any) -> _models.RoleDefin
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleDefinitionId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_client.py
index 5ad48e5dacbd..8c9b814e2828 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These calls handle provider operations.
@@ -64,7 +66,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -83,7 +103,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-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
@@ -103,12 +123,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_configuration.py
index 3a5e01a9072a..3f310cfd2dc7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_metadata.json
index 9a806fbd35d2..1e4ff21d6f0f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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": 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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"provider_operations_metadata": "ProviderOperationsMetadataOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_client.py
index 3925e922add3..45ba7bdcf06f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These calls handle provider operations.
@@ -64,7 +66,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -83,7 +103,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-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
@@ -103,12 +125,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_configuration.py
index b2152db43266..023b975798fb 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/__init__.py
index 0185ff6c9bb0..c6456ff5614a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_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 ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations
-from ._role_assignments_operations import RoleAssignmentsOperations
-from ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations # type: ignore
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # 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 @@
"PermissionsOperations",
"RoleDefinitionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py
index 6e00acd23c6b..8ab174b06533 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_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._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_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]]
@@ -60,7 +62,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
: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 Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission]
@@ -74,7 +75,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,16 +86,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -105,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("PermissionGetResult", pipeline_response)
@@ -122,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
@@ -139,10 +137,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -166,7 +160,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission]
@@ -180,7 +173,7 @@ def list_for_resource(
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,7 +184,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -199,12 +192,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -215,14 +206,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("PermissionGetResult", pipeline_response)
@@ -232,11 +222,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
@@ -248,7 +238,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_operations.py
index 496995dc7849..5c9c2ac55d6d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_provider_operations_metadata_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._provider_operations_metadata_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]]
@@ -64,12 +66,11 @@ async def get(
:type resource_provider_namespace: str
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderOperationsMetadata or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadata
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,20 +86,18 @@ async def get(
)
cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_provider_namespace=resource_provider_namespace,
expand=expand,
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
@@ -108,22 +107,20 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response)
+ deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_models.ProviderOperationsMetadata"]:
+ # pylint: disable=line-too-long
"""Gets provider operations metadata for all resource providers.
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderOperationsMetadata or the result of
cls(response)
:rtype:
@@ -138,7 +135,7 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_
)
cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -149,15 +146,13 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
expand=expand,
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
@@ -168,14 +163,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("ProviderOperationsMetadataListResult", pipeline_response)
@@ -185,11 +179,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
@@ -201,5 +195,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_operations.py
index 8f68827c9436..c022d54e481f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_assignments_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._role_assignments_operations import (
build_create_by_id_request,
build_create_request,
@@ -42,6 +40,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]]
@@ -94,7 +96,6 @@ def list_for_resource(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -108,7 +109,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -119,7 +120,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -128,12 +129,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -144,14 +143,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("RoleAssignmentListResult", pipeline_response)
@@ -161,11 +159,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
@@ -178,10 +176,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -195,7 +189,6 @@ def list_for_resource_group(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -209,7 +202,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -220,17 +213,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -241,14 +232,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("RoleAssignmentListResult", pipeline_response)
@@ -258,11 +248,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
@@ -275,10 +265,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace_async
async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
"""Deletes a role assignment.
@@ -287,12 +273,11 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
:type scope: str
:param role_assignment_name: The name of the role assignment to delete. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -308,20 +293,18 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -333,14 +316,12 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
async def create(
@@ -352,6 +333,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -370,7 +352,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -381,11 +362,12 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -399,11 +381,10 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -414,9 +395,10 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -430,18 +412,15 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -466,23 +445,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -492,14 +469,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("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -509,12 +484,11 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
:type scope: str
:param role_assignment_name: The name of the role assignment to get. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -530,20 +504,18 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -553,14 +525,12 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
@@ -568,12 +538,11 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro
:param role_id: The ID of the role assignment to delete. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -589,19 +558,17 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -613,14 +580,12 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@overload
async def create_by_id(
@@ -641,7 +606,6 @@ async def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -649,18 +613,17 @@ async def create_by_id(
@overload
async def create_by_id(
- self, role_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -668,25 +631,22 @@ async def create_by_id(
@distributed_trace_async
async def create_by_id(
- self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]], **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -711,22 +671,20 @@ async def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_id=role_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -736,14 +694,12 @@ async def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -751,12 +707,11 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment
:param role_id: The ID of the role assignment to get. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -772,19 +727,17 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -794,14 +747,12 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleAssignment"]:
@@ -811,7 +762,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -825,7 +775,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -836,16 +786,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -856,14 +804,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("RoleAssignmentListResult", pipeline_response)
@@ -873,11 +820,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
@@ -890,8 +837,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
@@ -904,7 +849,6 @@ def list_for_scope(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -918,7 +862,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -929,16 +873,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -949,14 +891,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("RoleAssignmentListResult", pipeline_response)
@@ -966,11 +907,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
@@ -982,5 +923,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_operations.py
index d90764340cff..ac347da9770f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_role_definitions_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._role_definitions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -37,6 +35,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,12 +71,11 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,20 +91,18 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
)
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -115,14 +114,12 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
@@ -132,12 +129,11 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -153,20 +149,18 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -176,14 +170,12 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -206,7 +198,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -217,7 +208,7 @@ async def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -229,11 +220,10 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -241,7 +231,11 @@ async def create_or_update(
@distributed_trace_async
async def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
"""Creates or updates a role definition.
@@ -250,18 +244,14 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
+ a IO[bytes] type. Required.
:type role_definition: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,23 +276,21 @@ async def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -312,14 +300,12 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]:
@@ -330,7 +316,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition]
@@ -344,7 +329,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
)
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -355,16 +340,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -375,14 +358,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("RoleDefinitionListResult", pipeline_response)
@@ -392,11 +374,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
@@ -409,8 +391,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace_async
async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -421,12 +401,11 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -442,19 +421,17 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -464,11 +441,9 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py
index 402dae854cc4..c409d72da8d6 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py
@@ -5,25 +5,34 @@
# 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 Permission
-from ._models_py3 import PermissionGetResult
-from ._models_py3 import ProviderOperation
-from ._models_py3 import ProviderOperationsMetadata
-from ._models_py3 import ProviderOperationsMetadataListResult
-from ._models_py3 import ResourceType
-from ._models_py3 import RoleAssignment
-from ._models_py3 import RoleAssignmentCreateParameters
-from ._models_py3 import RoleAssignmentFilter
-from ._models_py3 import RoleAssignmentListResult
-from ._models_py3 import RoleDefinition
-from ._models_py3 import RoleDefinitionFilter
-from ._models_py3 import RoleDefinitionListResult
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Permission,
+ PermissionGetResult,
+ ProviderOperation,
+ ProviderOperationsMetadata,
+ ProviderOperationsMetadataListResult,
+ ResourceType,
+ RoleAssignment,
+ RoleAssignmentCreateParameters,
+ RoleAssignmentFilter,
+ RoleAssignmentListResult,
+ RoleDefinition,
+ RoleDefinitionFilter,
+ RoleDefinitionListResult,
+)
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__ = [
@@ -44,5 +53,5 @@
"RoleDefinitionFilter",
"RoleDefinitionListResult",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py
index 03998151c3c9..e38320653b6c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_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.
@@ -15,10 +14,9 @@
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
- from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
@@ -458,7 +456,7 @@ def __init__(
class RoleAssignmentCreateParameters(_serialization.Model):
"""Role assignment create parameters.
- 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 role_definition_id: The role definition ID used in the role assignment. Required.
:vartype role_definition_id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py
index 0185ff6c9bb0..c6456ff5614a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_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 ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations
-from ._role_assignments_operations import RoleAssignmentsOperations
-from ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations # type: ignore
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # 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 @@
"PermissionsOperations",
"RoleDefinitionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py
index ec916a24c3f5..ac0be94bf5fd 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -99,7 +101,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -137,7 +139,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
: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 Permission or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission]
@@ -151,7 +152,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -162,16 +163,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -182,14 +181,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("PermissionGetResult", pipeline_response)
@@ -199,11 +197,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
@@ -216,10 +214,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -243,7 +237,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission]
@@ -257,7 +250,7 @@ def list_for_resource(
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -268,7 +261,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -276,12 +269,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -292,14 +283,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("PermissionGetResult", pipeline_response)
@@ -309,11 +299,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
@@ -325,7 +315,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py
index c447ad8b13c5..1bf071db0e70 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,12 +119,11 @@ def get(
:type resource_provider_namespace: str
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderOperationsMetadata or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadata
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -138,20 +139,18 @@ def get(
)
cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_provider_namespace=resource_provider_namespace,
expand=expand,
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
@@ -161,14 +160,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response)
+ deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_models.ProviderOperationsMetadata"]:
@@ -176,7 +173,6 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderOperationsMetadata or the result of
cls(response)
:rtype:
@@ -191,7 +187,7 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
)
cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -202,15 +198,13 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
expand=expand,
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 +215,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("ProviderOperationsMetadataListResult", pipeline_response)
@@ -238,11 +231,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
@@ -254,5 +247,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py
index 455091767542..50aab3c56e6d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py
@@ -7,6 +7,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 +21,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, _format_url_section
+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]]
@@ -72,7 +75,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -106,7 +109,7 @@ def build_list_for_resource_group_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -133,7 +136,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -159,7 +162,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -186,7 +189,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -210,7 +213,7 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -235,7 +238,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -261,7 +264,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -287,7 +290,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -313,7 +316,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -374,7 +377,6 @@ def list_for_resource(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -388,7 +390,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -399,7 +401,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -408,12 +410,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -424,14 +424,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("RoleAssignmentListResult", pipeline_response)
@@ -441,11 +440,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
@@ -458,10 +457,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -475,7 +470,6 @@ def list_for_resource_group(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -489,7 +483,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -500,17 +494,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -521,14 +513,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("RoleAssignmentListResult", pipeline_response)
@@ -538,11 +529,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
@@ -555,10 +546,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
"""Deletes a role assignment.
@@ -567,12 +554,11 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
:type scope: str
:param role_assignment_name: The name of the role assignment to delete. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -588,20 +574,18 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -613,14 +597,12 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
def create(
@@ -632,6 +614,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -650,7 +633,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -661,11 +643,12 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -679,11 +662,10 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -694,9 +676,10 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -710,18 +693,15 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -746,23 +726,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -772,14 +750,12 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -789,12 +765,11 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
:type scope: str
:param role_assignment_name: The name of the role assignment to get. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -810,20 +785,18 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -833,14 +806,12 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
@@ -848,12 +819,11 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi
:param role_id: The ID of the role assignment to delete. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -869,19 +839,17 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -893,14 +861,12 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@overload
def create_by_id(
@@ -921,7 +887,6 @@ def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -929,18 +894,17 @@ def create_by_id(
@overload
def create_by_id(
- self, role_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -948,25 +912,22 @@ def create_by_id(
@distributed_trace
def create_by_id(
- self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]], **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -991,22 +952,20 @@ def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_id=role_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -1016,14 +975,12 @@ def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -1031,12 +988,11 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
:param role_id: The ID of the role assignment to get. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1052,19 +1008,17 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -1074,14 +1028,12 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleAssignment"]:
@@ -1091,7 +1043,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -1105,7 +1056,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1116,16 +1067,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -1136,14 +1085,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("RoleAssignmentListResult", pipeline_response)
@@ -1153,11 +1101,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
@@ -1170,8 +1118,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
@@ -1184,7 +1130,6 @@ def list_for_scope(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment]
@@ -1198,7 +1143,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1209,16 +1154,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -1229,14 +1172,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("RoleAssignmentListResult", pipeline_response)
@@ -1246,11 +1188,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
@@ -1262,5 +1204,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py
index ac7d84073fdb..27df5324e407 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) ->
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,7 +78,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -102,7 +104,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -128,7 +130,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -154,7 +156,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -193,12 +195,11 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,20 +215,18 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
)
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -239,14 +238,12 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
@@ -256,12 +253,11 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -277,20 +273,18 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -300,14 +294,12 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -330,7 +322,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -341,7 +332,7 @@ def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -353,11 +344,10 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -365,7 +355,11 @@ def create_or_update(
@distributed_trace
def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
"""Creates or updates a role definition.
@@ -374,18 +368,14 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
+ a IO[bytes] type. Required.
:type role_definition: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -410,23 +400,21 @@ def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -436,14 +424,12 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]:
@@ -454,7 +440,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition]
@@ -468,7 +453,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
)
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -479,16 +464,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -499,14 +482,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("RoleDefinitionListResult", pipeline_response)
@@ -516,11 +498,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
@@ -533,8 +515,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace
def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -545,12 +525,11 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -566,19 +545,17 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -588,11 +565,9 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py
index e80e2c8a5e3c..1cbc3704695f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_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
@@ -28,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -85,7 +87,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -121,7 +141,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-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
@@ -141,12 +161,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py
index 676d7f01a754..d47e36baa338 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_metadata.json
index aefc25530dbf..f156863d3740 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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": 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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"operations": "Operations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_client.py
index 0d346caa3a09..f31ac7a85ccb 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_authorization_management_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
@@ -28,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -85,7 +87,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -121,7 +141,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-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
@@ -141,12 +163,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_configuration.py
index 11425fcc1e0e..5f07d1950976 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py
index 0bb9a6bebd04..b4ae1f3f59fa 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/__init__.py
@@ -5,23 +5,25 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._operations import Operations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # 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__ = [
@@ -35,5 +37,5 @@
"AccessReviewInstancesAssignedForMyApprovalOperations",
"AccessReviewInstanceMyDecisionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_operations.py
index 4093f9122e0d..85f2bbdcc344 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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._access_review_default_settings_operations import build_get_request, build_put_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]]
@@ -56,12 +58,11 @@ def __init__(self, *args, **kwargs) -> None:
async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -77,19 +78,17 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -99,16 +98,12 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
async def put(
@@ -122,7 +117,6 @@ async def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -130,16 +124,15 @@ async def put(
@overload
async def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -147,23 +140,19 @@ async def put(
@distributed_trace_async
async def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_05_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,22 +177,20 @@ async def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -213,13 +200,9 @@ async def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_operations.py
index 73ed017371b3..1b6e8d3eda82 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_decisions_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._access_review_instance_decisions_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, schedule_definition_id: str, id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = 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(
schedule_definition_id=schedule_definition_id,
id=id,
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("AccessReviewDecisionListResult", 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.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
index ab73f5220fa7..9458deab3283 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_my_decisions_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,26 +20,28 @@
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._access_review_instance_my_decisions_operations import (
build_get_by_id_request,
build_list_request,
build_patch_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 AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -63,13 +65,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get my access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -84,7 +86,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,16 +97,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=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("AccessReviewDecisionListResult", 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
@@ -149,10 +148,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace_async
async def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -165,12 +160,11 @@ async def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -186,21 +180,19 @@ async def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -210,16 +202,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
async def patch(
@@ -246,7 +234,6 @@ async def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -258,7 +245,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -272,11 +259,10 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -288,7 +274,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -300,18 +286,15 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_05_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -336,7 +319,7 @@ async def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -344,16 +327,14 @@ async def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -363,13 +344,9 @@ async def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_operations.py
index f48d95fd5364..611eeebc7022 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instance_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,14 +17,12 @@
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._access_review_instance_operations import (
build_accept_recommendations_request,
build_apply_decisions_request,
@@ -33,6 +31,10 @@
build_stop_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]]
@@ -58,21 +60,18 @@ def __init__(self, *args, **kwargs) -> None:
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to stop an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -88,21 +87,19 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -113,28 +110,21 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def reset_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def reset_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to reset all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -150,21 +140,19 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -175,28 +163,21 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def apply_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def apply_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to apply all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -212,21 +193,19 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -237,28 +216,21 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def send_reminders( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def send_reminders(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to send reminders for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -274,21 +246,19 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -299,28 +269,21 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def accept_recommendations( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def accept_recommendations(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to accept recommendations for decision in an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -336,20 +299,18 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -360,8 +321,4 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
index 851f3ad97599..4abd4528781f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_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,25 +19,27 @@
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._access_review_instances_assigned_for_my_approval_operations import (
build_get_by_id_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]]
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -59,11 +61,11 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_mo
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,15 +91,13 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_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
@@ -108,14 +108,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("AccessReviewInstanceListResult", pipeline_response)
@@ -125,11 +124,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
@@ -142,10 +141,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -154,12 +149,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -175,20 +169,18 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -198,13 +190,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_operations.py
index 486b19bc7043..463403a090ba 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_instances_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._access_review_instances_operations import build_get_by_id_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]]
@@ -56,11 +58,11 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -75,7 +77,7 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_mo
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,16 +88,14 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> AsyncIterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
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
@@ -106,14 +106,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("AccessReviewInstanceListResult", pipeline_response)
@@ -123,11 +122,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
@@ -140,10 +139,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -152,12 +147,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,21 +167,19 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -197,13 +189,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index efcd59d346a3..ea8f4ac20f0c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_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,21 +19,23 @@
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._access_review_schedule_definitions_assigned_for_my_approval_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]]
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -55,9 +57,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -72,7 +74,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AccessReviewScheduleDefi
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = 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.AccessReviewScheduleDefi
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("AccessReviewScheduleDefinitionListResult", 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.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
index 8a2c955b98db..1ba2f27bafab 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_access_review_schedule_definitions_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._access_review_schedule_definitions_operations import (
build_create_or_update_by_id_request,
build_delete_by_id_request,
@@ -37,11 +35,15 @@
build_stop_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 AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -63,9 +65,9 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -80,7 +82,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AccessReviewScheduleDefi
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -91,15 +93,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AccessReviewScheduleDefi
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
@@ -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("AccessReviewScheduleDefinitionListResult", 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
@@ -144,22 +143,17 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -175,20 +169,18 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -198,31 +190,24 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete_by_id( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def delete_by_id(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Delete access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -238,20 +223,18 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -262,11 +245,7 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def create_or_update_by_id(
@@ -287,7 +266,6 @@ async def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -295,18 +273,22 @@ async def create_or_update_by_id(
@overload
async def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -316,7 +298,7 @@ async def create_or_update_by_id(
async def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -324,19 +306,15 @@ async def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -361,23 +339,21 @@ async def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -387,31 +363,24 @@ async def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Stop access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -427,20 +396,18 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -451,8 +418,4 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_operations.py
index 70974ee792c4..3086c61b4522 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/aio/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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]]
@@ -57,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_05_01_preview.models.Operation]
@@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -82,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
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 +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("OperationListResult", pipeline_response)
@@ -117,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
@@ -133,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py
index 62c0a076e536..e1c1620736fc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py
@@ -5,42 +5,53 @@
# 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 AccessReviewDecision
-from ._models_py3 import AccessReviewDecisionListResult
-from ._models_py3 import AccessReviewDecisionProperties
-from ._models_py3 import AccessReviewDecisionTarget
-from ._models_py3 import AccessReviewDefaultSettings
-from ._models_py3 import AccessReviewInstance
-from ._models_py3 import AccessReviewInstanceListResult
-from ._models_py3 import AccessReviewReviewer
-from ._models_py3 import AccessReviewScheduleDefinition
-from ._models_py3 import AccessReviewScheduleDefinitionListResult
-from ._models_py3 import AccessReviewScheduleDefinitionProperties
-from ._models_py3 import AccessReviewScheduleSettings
-from ._models_py3 import ErrorDefinition
-from ._models_py3 import ErrorDefinitionProperties
-from ._models_py3 import Operation
-from ._models_py3 import OperationDisplay
-from ._models_py3 import OperationListResult
-from ._models_py3 import ServicePrincipalDecisionTarget
-from ._models_py3 import UserDecisionTarget
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import AccessRecommendationType
-from ._authorization_management_client_enums import AccessReviewActorIdentityType
-from ._authorization_management_client_enums import AccessReviewApplyResult
-from ._authorization_management_client_enums import AccessReviewInstanceStatus
-from ._authorization_management_client_enums import AccessReviewRecurrencePatternType
-from ._authorization_management_client_enums import AccessReviewRecurrenceRangeType
-from ._authorization_management_client_enums import AccessReviewResult
-from ._authorization_management_client_enums import AccessReviewReviewerType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionReviewersType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionStatus
-from ._authorization_management_client_enums import AccessReviewScopePrincipalType
-from ._authorization_management_client_enums import DecisionTargetType
-from ._authorization_management_client_enums import DefaultDecisionType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessReviewDecision,
+ AccessReviewDecisionListResult,
+ AccessReviewDecisionProperties,
+ AccessReviewDecisionTarget,
+ AccessReviewDefaultSettings,
+ AccessReviewInstance,
+ AccessReviewInstanceListResult,
+ AccessReviewReviewer,
+ AccessReviewScheduleDefinition,
+ AccessReviewScheduleDefinitionListResult,
+ AccessReviewScheduleDefinitionProperties,
+ AccessReviewScheduleSettings,
+ ErrorDefinition,
+ ErrorDefinitionProperties,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ ServicePrincipalDecisionTarget,
+ UserDecisionTarget,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ AccessRecommendationType,
+ AccessReviewActorIdentityType,
+ AccessReviewApplyResult,
+ AccessReviewInstanceStatus,
+ AccessReviewRecurrencePatternType,
+ AccessReviewRecurrenceRangeType,
+ AccessReviewResult,
+ AccessReviewReviewerType,
+ AccessReviewScheduleDefinitionReviewersType,
+ AccessReviewScheduleDefinitionStatus,
+ AccessReviewScopePrincipalType,
+ DecisionTargetType,
+ DefaultDecisionType,
+)
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__ = [
@@ -77,5 +88,5 @@
"DecisionTargetType",
"DefaultDecisionType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py
index 1440b3c8986f..c3740c016476 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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.
@@ -13,11 +13,10 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
-class AccessReviewDecision(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecision(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -203,7 +202,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewDecisionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecisionProperties(_serialization.Model):
"""Approval Step.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -326,7 +325,7 @@ class AccessReviewDecisionTarget(_serialization.Model):
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
ServicePrincipalDecisionTarget, UserDecisionTarget
- 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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -349,7 +348,7 @@ def __init__(self, **kwargs: Any) -> None:
self.type: Optional[str] = None
-class AccessReviewDefaultSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDefaultSettings(_serialization.Model):
"""Access Review Default Settings.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -646,7 +645,7 @@ def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None
self.principal_type = None
-class AccessReviewScheduleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinition(_serialization.Model):
"""Access Review Schedule Definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -965,7 +964,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewScheduleDefinitionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinitionProperties(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1218,7 +1217,7 @@ def __init__( # pylint: disable=too-many-locals
self.user_principal_name = None
-class AccessReviewScheduleSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleSettings(_serialization.Model):
"""Settings of an Access Review.
:ivar mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the
@@ -1535,7 +1534,7 @@ class ServicePrincipalDecisionTarget(AccessReviewDecisionTarget):
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -1576,7 +1575,7 @@ class UserDecisionTarget(AccessReviewDecisionTarget):
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py
index 0bb9a6bebd04..b4ae1f3f59fa 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py
@@ -5,23 +5,25 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._operations import Operations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # 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__ = [
@@ -35,5 +37,5 @@
"AccessReviewInstancesAssignedForMyApprovalOperations",
"AccessReviewInstanceMyDecisionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py
index 5eb5975a1621..49f8330c977b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -116,12 +118,11 @@ def __init__(self, *args, **kwargs):
def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,19 +138,17 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -159,16 +158,12 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
def put(
@@ -182,7 +177,6 @@ def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -190,16 +184,15 @@ def put(
@overload
def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -207,23 +200,19 @@ def put(
@distributed_trace
def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_05_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,22 +237,20 @@ def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -273,13 +260,9 @@ def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py
index 1c86e8c0737f..6b7252a72559 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -93,7 +95,6 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -108,7 +109,7 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -119,17 +120,15 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
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
@@ -140,14 +139,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("AccessReviewDecisionListResult", pipeline_response)
@@ -157,11 +155,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
@@ -173,7 +171,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py
index b2b8dae079ef..f76b79aca079 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,7 +115,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -126,7 +128,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -154,7 +156,6 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -169,7 +170,7 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -180,16 +181,14 @@ def list(self, schedule_definition_id: str, id: str, **kwargs: Any) -> Iterable[
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=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
@@ -200,14 +199,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("AccessReviewDecisionListResult", pipeline_response)
@@ -217,11 +215,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
@@ -234,10 +232,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace
def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -250,12 +244,11 @@ def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -271,21 +264,19 @@ def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -295,16 +286,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
def patch(
@@ -331,7 +318,6 @@ def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -343,7 +329,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -357,11 +343,10 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -373,7 +358,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -385,18 +370,15 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_05_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -421,7 +403,7 @@ def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -429,16 +411,14 @@ def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -448,13 +428,9 @@ def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py
index 1b5d7c5a7588..9d56e4c1a148 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_reset_decisions_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -114,7 +116,7 @@ def build_apply_decisions_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -145,7 +147,7 @@ def build_send_reminders_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +175,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, *
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -214,12 +216,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -235,21 +236,19 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -260,11 +259,7 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def reset_decisions( # pylint: disable=inconsistent-return-statements
@@ -276,12 +271,11 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -297,21 +291,19 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -322,11 +314,7 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def apply_decisions( # pylint: disable=inconsistent-return-statements
@@ -338,12 +326,11 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -359,21 +346,19 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -384,11 +369,7 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def send_reminders( # pylint: disable=inconsistent-return-statements
@@ -400,12 +381,11 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -421,21 +401,19 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -446,11 +424,7 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def accept_recommendations( # pylint: disable=inconsistent-return-statements
@@ -462,12 +436,11 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -483,20 +456,18 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -507,8 +478,4 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
index 4f262f516dfa..50f47b278151 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_list_request(schedule_definition_id: str, **kwargs: Any) -> HttpReques
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -80,7 +82,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -91,7 +93,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -117,7 +119,6 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -132,7 +133,7 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models.
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -143,15 +144,13 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models.
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_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
@@ -162,14 +161,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("AccessReviewInstanceListResult", pipeline_response)
@@ -179,11 +177,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
@@ -196,10 +194,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -208,12 +202,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -229,20 +222,18 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -252,13 +243,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py
index e944e31089c8..d54d2e317199 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(schedule_definition_id: str, subscription_id: str, **kwar
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -82,7 +84,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -119,7 +121,6 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -134,7 +135,7 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models.
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,16 +146,14 @@ def list(self, schedule_definition_id: str, **kwargs: Any) -> Iterable["_models.
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
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
@@ -165,14 +164,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("AccessReviewInstanceListResult", pipeline_response)
@@ -182,11 +180,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
@@ -199,10 +197,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -211,12 +205,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -232,21 +225,19 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -256,13 +247,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index ebc0067a2fd3..a3f94b37b539 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_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]]
@@ -55,7 +57,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest:
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -77,9 +79,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinitio
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = 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.AccessReviewScheduleDefinitio
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("AccessReviewScheduleDefinitionListResult", 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.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py
index f426bc61978c..bc07bfeb6ea4 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +83,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, *
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -109,7 +111,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -140,7 +142,7 @@ def build_create_or_update_by_id_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -170,7 +172,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -181,7 +183,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -203,9 +205,9 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -220,7 +222,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinitio
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -231,15 +233,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinitio
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
@@ -250,14 +250,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -267,11 +266,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
@@ -284,22 +283,17 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -315,20 +309,18 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -338,16 +330,12 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id( # pylint: disable=inconsistent-return-statements
@@ -357,12 +345,11 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -378,20 +365,18 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -402,11 +387,7 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def create_or_update_by_id(
@@ -427,7 +408,6 @@ def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -435,18 +415,22 @@ def create_or_update_by_id(
@overload
def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -456,7 +440,7 @@ def create_or_update_by_id(
def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -464,19 +448,15 @@ def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -501,23 +481,21 @@ def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -527,16 +505,12 @@ def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def stop( # pylint: disable=inconsistent-return-statements
@@ -546,12 +520,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -567,20 +540,18 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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,8 +562,4 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py
index d924a02a47bb..7b71484815b9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_05_01_preview.models.Operation]
@@ -93,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = 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.Operation"]:
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("OperationListResult", 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.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_client.py
index 7975dfdc77be..264232a85d79 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_authorization_management_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 DenyAssignmentsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to get deny
assignments. A deny assignment describes the set of actions on resources that are denied for
@@ -52,7 +54,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -62,7 +82,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-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
@@ -82,12 +102,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_configuration.py
index 284188d97bca..e6ca39ebcdad 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-07-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_metadata.json
index 92e1896abe79..6bf3dc59c75b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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": 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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"deny_assignments": "DenyAssignmentsOperations"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_client.py
index 0ebc0b77e131..2765d02739f7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_authorization_management_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 DenyAssignmentsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to get deny
assignments. A deny assignment describes the set of actions on resources that are denied for
@@ -52,7 +54,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -62,7 +82,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-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
@@ -82,12 +104,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_configuration.py
index c302fa6a1cab..b32aa66e3839 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-07-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/__init__.py
index 9118a306bbaa..1564544cc806 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_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 ._deny_assignments_operations import DenyAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._deny_assignments_operations import DenyAssignmentsOperations # 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__ = [
"DenyAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_operations.py
index ff430ddfd414..8eefaa133b19 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/aio/operations/_deny_assignments_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,15 +19,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._deny_assignments_operations import (
build_get_by_id_request,
build_get_request,
@@ -37,6 +35,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]]
@@ -96,7 +98,6 @@ def list_for_resource(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -110,7 +111,7 @@ def list_for_resource(
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -121,7 +122,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -130,12 +131,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -146,14 +145,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("DenyAssignmentListResult", pipeline_response)
@@ -163,11 +161,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
@@ -180,10 +178,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -204,7 +198,6 @@ def list_for_resource_group(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -218,7 +211,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -229,17 +222,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -250,14 +241,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("DenyAssignmentListResult", pipeline_response)
@@ -267,11 +257,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
@@ -284,10 +274,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.DenyAssignment"]:
"""Gets all deny assignments for the subscription.
@@ -303,7 +289,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -317,7 +302,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -328,16 +313,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -348,14 +331,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("DenyAssignmentListResult", pipeline_response)
@@ -365,11 +347,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
@@ -382,8 +364,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"}
-
@distributed_trace_async
async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
"""Get the specified deny assignment.
@@ -392,12 +372,11 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode
:type scope: str
:param deny_assignment_id: The ID of the deny assignment to get. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -413,20 +392,18 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode
)
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
deny_assignment_id=deny_assignment_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
@@ -436,14 +413,12 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
@@ -455,12 +430,11 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den
/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny
assignments. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -476,19 +450,17 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den
)
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
deny_assignment_id=deny_assignment_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -498,14 +470,12 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -526,7 +496,6 @@ def list_for_scope(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -540,7 +509,7 @@ def list_for_scope(
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -551,16 +520,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -571,14 +538,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("DenyAssignmentListResult", pipeline_response)
@@ -588,11 +554,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
@@ -604,5 +570,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py
index c01af9a96f46..f700159adae0 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py
@@ -5,17 +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 ._models_py3 import DenyAssignment
-from ._models_py3 import DenyAssignmentFilter
-from ._models_py3 import DenyAssignmentListResult
-from ._models_py3 import DenyAssignmentPermission
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Principal
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ DenyAssignment,
+ DenyAssignmentFilter,
+ DenyAssignmentListResult,
+ DenyAssignmentPermission,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Principal,
+)
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__ = [
@@ -28,5 +37,5 @@
"ErrorResponse",
"Principal",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py
index 0d2f93fa38ae..4865b014a077 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_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.
@@ -12,11 +11,10 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
-class DenyAssignment(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class DenyAssignment(_serialization.Model):
"""Deny Assignment.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/__init__.py
index 9118a306bbaa..1564544cc806 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_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 ._deny_assignments_operations import DenyAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._deny_assignments_operations import DenyAssignmentsOperations # 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__ = [
"DenyAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py
index 7549851ad47d..83c57faf163b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_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, _format_url_section
+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]]
@@ -71,7 +73,7 @@ def build_list_for_resource_request(
"resourceName": _SERIALIZER.url("resource_name", resource_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -105,7 +107,7 @@ def build_list_for_resource_group_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -133,7 +135,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -160,7 +162,7 @@ def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> Htt
"denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -184,7 +186,7 @@ def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpReque
"denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -208,7 +210,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -276,7 +278,6 @@ def list_for_resource(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -290,7 +291,7 @@ def list_for_resource(
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -301,7 +302,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -310,12 +311,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -326,14 +325,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("DenyAssignmentListResult", pipeline_response)
@@ -343,11 +341,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
@@ -360,10 +358,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -384,7 +378,6 @@ def list_for_resource_group(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -398,7 +391,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -409,17 +402,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -430,14 +421,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("DenyAssignmentListResult", pipeline_response)
@@ -447,11 +437,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
@@ -464,10 +454,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.DenyAssignment"]:
"""Gets all deny assignments for the subscription.
@@ -483,7 +469,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -497,7 +482,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,16 +493,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -528,14 +511,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("DenyAssignmentListResult", pipeline_response)
@@ -545,11 +527,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
@@ -562,8 +544,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"}
-
@distributed_trace
def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
"""Get the specified deny assignment.
@@ -572,12 +552,11 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den
:type scope: str
:param deny_assignment_id: The ID of the deny assignment to get. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -593,20 +572,18 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den
)
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
deny_assignment_id=deny_assignment_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
@@ -616,14 +593,12 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
@@ -635,12 +610,11 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig
/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny
assignments. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -656,19 +630,17 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig
)
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
deny_assignment_id=deny_assignment_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -678,14 +650,12 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -706,7 +676,6 @@ def list_for_scope(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment]
@@ -720,7 +689,7 @@ def list_for_scope(
)
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -731,16 +700,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -751,14 +718,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("DenyAssignmentListResult", pipeline_response)
@@ -768,11 +734,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,5 +750,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_client.py
index e62641a6e5bf..5aae5a3b6d67 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_authorization_management_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 RoleAssignmentsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -51,7 +53,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -61,7 +81,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-09-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
@@ -81,12 +101,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_configuration.py
index 863895fcb33f..858c9c048326 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-09-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_metadata.json
index a6c48bf89a75..f49ae1d2ba55 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"role_assignments": "RoleAssignmentsOperations"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_client.py
index a9c7a08d8f5e..7408ac5ce376 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_authorization_management_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 RoleAssignmentsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -51,7 +53,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -61,7 +81,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2018-09-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
@@ -81,12 +103,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_configuration.py
index 8841ae1b0d47..8f462b18f764 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2018-09-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/__init__.py
index 0d22b3a23897..6b17bf7f6f59 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_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 ._role_assignments_operations import RoleAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignments_operations import RoleAssignmentsOperations # 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__ = [
"RoleAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_operations.py
index 1b10589d163f..1e665b90d1e9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/aio/operations/_role_assignments_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._role_assignments_operations import (
build_create_by_id_request,
build_create_request,
@@ -42,6 +40,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]]
@@ -94,7 +96,6 @@ def list_for_resource(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -108,7 +109,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -119,7 +120,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -128,12 +129,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -144,14 +143,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("RoleAssignmentListResult", pipeline_response)
@@ -161,11 +159,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
@@ -178,10 +176,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -195,7 +189,6 @@ def list_for_resource_group(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -209,7 +202,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -220,17 +213,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -241,14 +232,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("RoleAssignmentListResult", pipeline_response)
@@ -258,11 +248,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
@@ -275,10 +265,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace_async
async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
"""Deletes a role assignment.
@@ -287,12 +273,11 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
:type scope: str
:param role_assignment_name: The name of the role assignment to delete. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -308,20 +293,18 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -333,14 +316,12 @@ async def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) ->
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
async def create(
@@ -352,6 +333,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -370,7 +352,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -381,11 +362,12 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -399,11 +381,10 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -414,9 +395,10 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -430,18 +412,15 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -466,23 +445,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -492,14 +469,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("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -509,12 +484,11 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
:type scope: str
:param role_assignment_name: The name of the role assignment to get. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -530,20 +504,18 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -553,14 +525,12 @@ async def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _mo
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
@@ -568,12 +538,11 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro
:param role_id: The ID of the role assignment to delete. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -589,19 +558,17 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -613,14 +580,12 @@ async def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.Ro
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@overload
async def create_by_id(
@@ -641,7 +606,6 @@ async def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -649,18 +613,17 @@ async def create_by_id(
@overload
async def create_by_id(
- self, role_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -668,25 +631,22 @@ async def create_by_id(
@distributed_trace_async
async def create_by_id(
- self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]], **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -711,22 +671,20 @@ async def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_id=role_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -736,14 +694,12 @@ async def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -751,12 +707,11 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment
:param role_id: The ID of the role assignment to get. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -772,19 +727,17 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -794,14 +747,12 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleAssignment"]:
@@ -811,7 +762,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -825,7 +775,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -836,16 +786,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -856,14 +804,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("RoleAssignmentListResult", pipeline_response)
@@ -873,11 +820,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
@@ -890,8 +837,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
@@ -904,7 +849,6 @@ def list_for_scope(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -918,7 +862,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -929,16 +873,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -949,14 +891,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("RoleAssignmentListResult", pipeline_response)
@@ -966,11 +907,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
@@ -982,5 +923,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py
index ca8ae3cbd5a1..154df31f0063 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py
@@ -5,18 +5,29 @@
# 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 RoleAssignment
-from ._models_py3 import RoleAssignmentCreateParameters
-from ._models_py3 import RoleAssignmentFilter
-from ._models_py3 import RoleAssignmentListResult
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import PrincipalType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ RoleAssignment,
+ RoleAssignmentCreateParameters,
+ RoleAssignmentFilter,
+ RoleAssignmentListResult,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ PrincipalType,
+)
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 +40,5 @@
"RoleAssignmentListResult",
"PrincipalType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py
index ab4f4604c7cd..802bf6f11d74 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_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.
@@ -12,7 +11,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -189,7 +187,7 @@ def __init__(
class RoleAssignmentCreateParameters(_serialization.Model):
"""Role assignment create parameters.
- 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 role_definition_id: The role definition ID used in the role assignment. Required.
:vartype role_definition_id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/__init__.py
index 0d22b3a23897..6b17bf7f6f59 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_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 ._role_assignments_operations import RoleAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignments_operations import RoleAssignmentsOperations # 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__ = [
"RoleAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py
index 36aeaa1c57e6..e361d9cba6b8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py
@@ -7,6 +7,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 +21,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, _format_url_section
+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]]
@@ -72,7 +75,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -106,7 +109,7 @@ def build_list_for_resource_group_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -133,7 +136,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -159,7 +162,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -186,7 +189,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -210,7 +213,7 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -235,7 +238,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -261,7 +264,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -287,7 +290,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -313,7 +316,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -374,7 +377,6 @@ def list_for_resource(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -388,7 +390,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -399,7 +401,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -408,12 +410,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -424,14 +424,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("RoleAssignmentListResult", pipeline_response)
@@ -441,11 +440,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
@@ -458,10 +457,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -475,7 +470,6 @@ def list_for_resource_group(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -489,7 +483,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -500,17 +494,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -521,14 +513,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("RoleAssignmentListResult", pipeline_response)
@@ -538,11 +529,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
@@ -555,10 +546,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
"""Deletes a role assignment.
@@ -567,12 +554,11 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
:type scope: str
:param role_assignment_name: The name of the role assignment to delete. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -588,20 +574,18 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -613,14 +597,12 @@ def delete(self, scope: str, role_assignment_name: str, **kwargs: Any) -> Option
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
def create(
@@ -632,6 +614,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -650,7 +633,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -661,11 +643,12 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -679,11 +662,10 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -694,9 +676,10 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Creates a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -710,18 +693,15 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -746,23 +726,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -772,14 +750,12 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -789,12 +765,11 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
:type scope: str
:param role_assignment_name: The name of the role assignment to get. Required.
:type role_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -810,20 +785,18 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
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
@@ -833,14 +806,12 @@ def get(self, scope: str, role_assignment_name: str, **kwargs: Any) -> _models.R
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssignment]:
@@ -848,12 +819,11 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi
:param role_id: The ID of the role assignment to delete. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -869,19 +839,17 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -893,14 +861,12 @@ def delete_by_id(self, role_id: str, **kwargs: Any) -> Optional[_models.RoleAssi
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@overload
def create_by_id(
@@ -921,7 +887,6 @@ def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -929,18 +894,17 @@ def create_by_id(
@overload
def create_by_id(
- self, role_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -948,25 +912,22 @@ def create_by_id(
@distributed_trace
def create_by_id(
- self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]], **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2018_09_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -991,22 +952,20 @@ def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_id=role_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -1016,14 +975,12 @@ def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
@@ -1031,12 +988,11 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
:param role_id: The ID of the role assignment to get. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1052,19 +1008,17 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -1074,14 +1028,12 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleAssignment:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleAssignment"]:
@@ -1091,7 +1043,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -1105,7 +1056,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1116,16 +1067,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -1136,14 +1085,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("RoleAssignmentListResult", pipeline_response)
@@ -1153,11 +1101,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
@@ -1170,8 +1118,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
@@ -1184,7 +1130,6 @@ def list_for_scope(
assignments at or above the scope. Use $filter=principalId eq {id} to return all role
assignments at, above or below the scope for the specified principal. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment]
@@ -1198,7 +1143,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1209,16 +1154,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -1229,14 +1172,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("RoleAssignmentListResult", pipeline_response)
@@ -1246,11 +1188,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
@@ -1262,5 +1204,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_client.py
index deb75cdee38b..e0b20cd4b471 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_authorization_management_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 RoleAssignmentMetricsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -51,7 +53,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -61,7 +81,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2019-08-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
@@ -81,12 +101,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_configuration.py
index e4a18fcf0fa3..18c918d5bdb2 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2019-08-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_metadata.json
index 935618b6c875..3f78abcbdcf2 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"role_assignment_metrics": "RoleAssignmentMetricsOperations"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_client.py
index e68025f85285..e4f6d525e36b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_authorization_management_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 RoleAssignmentMetricsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -51,7 +53,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -61,7 +81,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2019-08-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
@@ -81,12 +103,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_configuration.py
index 66d50b07bc2a..6a761607500e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2019-08-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/__init__.py
index b9b816cbd62e..9caacae3df4a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_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 ._role_assignment_metrics_operations import RoleAssignmentMetricsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignment_metrics_operations import RoleAssignmentMetricsOperations # 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__ = [
"RoleAssignmentMetricsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_operations.py
index 8fde64168d76..4a56b85f4767 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/aio/operations/_role_assignment_metrics_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._role_assignment_metrics_operations import build_get_metrics_for_subscription_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,12 +57,11 @@ def __init__(self, *args, **kwargs) -> None:
async def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssignmentMetricsResult:
"""Get role assignment usage metrics for a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentMetricsResult or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2019_08_01_preview.models.RoleAssignmentMetricsResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -76,19 +77,17 @@ async def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssig
)
cls: ClsType[_models.RoleAssignmentMetricsResult] = kwargs.pop("cls", None)
- request = build_get_metrics_for_subscription_request(
+ _request = build_get_metrics_for_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_metrics_for_subscription.metadata["url"],
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
@@ -98,13 +97,9 @@ async def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssig
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentMetricsResult", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentMetricsResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_metrics_for_subscription.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py
index 9af825dd8848..e1e09ba2a922 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/__init__.py
@@ -5,13 +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 ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import RoleAssignmentMetricsResult
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ RoleAssignmentMetricsResult,
+)
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__ = [
@@ -20,5 +29,5 @@
"ErrorResponse",
"RoleAssignmentMetricsResult",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/_models_py3.py
index 0d8478057cff..ce00480999bb 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_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.
@@ -12,7 +11,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/__init__.py
index b9b816cbd62e..9caacae3df4a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_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 ._role_assignment_metrics_operations import RoleAssignmentMetricsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignment_metrics_operations import RoleAssignmentMetricsOperations # 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__ = [
"RoleAssignmentMetricsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py
index 41ab3da09a46..1bfb48bbd08b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_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, _format_url_section
+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]]
@@ -34,7 +36,9 @@
_SERIALIZER.client_side_validation = False
-def build_get_metrics_for_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
+def build_get_metrics_for_subscription_request( # pylint: disable=name-too-long
+ subscription_id: str, **kwargs: Any
+) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
@@ -49,7 +53,7 @@ def build_get_metrics_for_subscription_request(subscription_id: str, **kwargs: A
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -84,12 +88,11 @@ def __init__(self, *args, **kwargs):
def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssignmentMetricsResult:
"""Get role assignment usage metrics for a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentMetricsResult or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2019_08_01_preview.models.RoleAssignmentMetricsResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,19 +108,17 @@ def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssignmentM
)
cls: ClsType[_models.RoleAssignmentMetricsResult] = kwargs.pop("cls", None)
- request = build_get_metrics_for_subscription_request(
+ _request = build_get_metrics_for_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_metrics_for_subscription.metadata["url"],
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
@@ -127,13 +128,9 @@ def get_metrics_for_subscription(self, **kwargs: Any) -> _models.RoleAssignmentM
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentMetricsResult", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentMetricsResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_metrics_for_subscription.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py
index 3cdc34f3a2c0..80ccacd92b62 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_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 RoleAssignmentsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -51,7 +53,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -61,7 +81,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2020-04-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
@@ -81,12 +101,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py
index 80f427785333..5b6e13dadf29 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-04-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_metadata.json
index 6ff2f6e79701..20bc5e300e11 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"role_assignments": "RoleAssignmentsOperations"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_client.py
index d2be59ccf08a..250ac344f8fd 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_authorization_management_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 RoleAssignmentsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -51,7 +53,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -61,7 +81,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2020-04-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
@@ -81,12 +103,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_configuration.py
index 741cb552215b..97f6a9e8ee38 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-04-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/__init__.py
index 0d22b3a23897..6b17bf7f6f59 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_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 ._role_assignments_operations import RoleAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignments_operations import RoleAssignmentsOperations # 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__ = [
"RoleAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_operations.py
index 83d7ed40c526..a2b0959a76be 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/aio/operations/_role_assignments_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._role_assignments_operations import (
build_create_by_id_request,
build_create_request,
@@ -42,6 +40,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]]
@@ -97,7 +99,6 @@ def list_for_resource(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -111,7 +112,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -122,7 +123,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -132,12 +133,10 @@ def prepare_request(next_link=None):
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -148,14 +147,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("RoleAssignmentListResult", pipeline_response)
@@ -165,11 +163,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
@@ -182,10 +180,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -201,7 +195,6 @@ def list_for_resource_group(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -215,7 +208,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -226,18 +219,16 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -248,14 +239,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("RoleAssignmentListResult", pipeline_response)
@@ -265,11 +255,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
@@ -282,10 +272,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace_async
async def delete(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -298,12 +284,11 @@ async def delete(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -319,21 +304,19 @@ async def delete(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -345,14 +328,12 @@ async def delete(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
async def create(
@@ -364,6 +345,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -382,7 +364,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -393,11 +374,12 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -411,11 +393,10 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -426,9 +407,10 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -442,18 +424,15 @@ async def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -478,23 +457,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -504,14 +481,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("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -525,12 +500,11 @@ async def get(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -546,21 +520,19 @@ async def get(
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -570,14 +542,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("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def delete_by_id(
@@ -589,12 +559,11 @@ async def delete_by_id(
:type role_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -610,20 +579,18 @@ async def delete_by_id(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_id=role_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -635,14 +602,12 @@ async def delete_by_id(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@overload
async def create_by_id(
@@ -663,7 +628,6 @@ async def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -671,18 +635,17 @@ async def create_by_id(
@overload
async def create_by_id(
- self, role_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -690,25 +653,22 @@ async def create_by_id(
@distributed_trace_async
async def create_by_id(
- self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]], **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -733,22 +693,20 @@ async def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_id=role_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -758,14 +716,12 @@ async def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> _models.RoleAssignment:
@@ -775,12 +731,11 @@ async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwarg
:type role_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -796,20 +751,18 @@ async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwarg
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -819,14 +772,12 @@ async def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwarg
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -840,7 +791,6 @@ def list(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -854,7 +804,7 @@ def list(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -865,17 +815,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_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
@@ -886,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("RoleAssignmentListResult", pipeline_response)
@@ -903,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
@@ -920,8 +867,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -936,7 +881,6 @@ def list_for_scope(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -950,7 +894,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -961,17 +905,15 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -982,14 +924,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("RoleAssignmentListResult", pipeline_response)
@@ -999,11 +940,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
@@ -1015,5 +956,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py
index ca8ae3cbd5a1..154df31f0063 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py
@@ -5,18 +5,29 @@
# 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 RoleAssignment
-from ._models_py3 import RoleAssignmentCreateParameters
-from ._models_py3 import RoleAssignmentFilter
-from ._models_py3 import RoleAssignmentListResult
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import PrincipalType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ RoleAssignment,
+ RoleAssignmentCreateParameters,
+ RoleAssignmentFilter,
+ RoleAssignmentListResult,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ PrincipalType,
+)
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 +40,5 @@
"RoleAssignmentListResult",
"PrincipalType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py
index 805b0304cbb9..eafb9d4e6e1c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_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
@@ -110,7 +108,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class RoleAssignment(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignment(_serialization.Model):
"""Role Assignments.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -255,7 +253,7 @@ def __init__(
class RoleAssignmentCreateParameters(_serialization.Model):
"""Role assignment create parameters.
- 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 role_definition_id: The role definition ID used in the role assignment. Required.
:vartype role_definition_id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py
index 0d22b3a23897..6b17bf7f6f59 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_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 ._role_assignments_operations import RoleAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignments_operations import RoleAssignmentsOperations # 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__ = [
"RoleAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py
index 709edb7a0bea..4fef34302432 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py
@@ -7,6 +7,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 +21,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, _format_url_section
+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]]
@@ -73,7 +76,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -114,7 +117,7 @@ def build_list_for_resource_group_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -145,7 +148,7 @@ def build_delete_request(
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +176,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -202,7 +205,7 @@ def build_get_request(
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -228,7 +231,7 @@ def build_delete_by_id_request(role_id: str, *, tenant_id: Optional[str] = None,
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -255,7 +258,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -281,7 +284,7 @@ def build_get_by_id_request(role_id: str, *, tenant_id: Optional[str] = None, **
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -311,7 +314,7 @@ def build_list_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -341,7 +344,7 @@ def build_list_for_scope_request(
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -407,7 +410,6 @@ def list_for_resource(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -421,7 +423,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +434,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -442,12 +444,10 @@ def prepare_request(next_link=None):
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -458,14 +458,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("RoleAssignmentListResult", pipeline_response)
@@ -475,11 +474,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
@@ -492,10 +491,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -511,7 +506,6 @@ def list_for_resource_group(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -525,7 +519,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -536,18 +530,16 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -558,14 +550,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("RoleAssignmentListResult", pipeline_response)
@@ -575,11 +566,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
@@ -592,10 +583,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def delete(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -608,12 +595,11 @@ def delete(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -629,21 +615,19 @@ def delete(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -655,14 +639,12 @@ def delete(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
def create(
@@ -674,6 +656,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -692,7 +675,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -703,11 +685,12 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -721,11 +704,10 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -736,9 +718,10 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create a role assignment.
:param scope: The scope of the role assignment to create. The scope can be any REST resource
@@ -752,18 +735,15 @@ def create(
and different for each role assignment. Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -788,23 +768,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -814,14 +792,12 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -835,12 +811,11 @@ def get(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -856,21 +831,19 @@ def get(
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -880,14 +853,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id(
@@ -899,12 +870,11 @@ def delete_by_id(
:type role_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -920,20 +890,18 @@ def delete_by_id(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_id=role_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -945,14 +913,12 @@ def delete_by_id(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@overload
def create_by_id(
@@ -973,7 +939,6 @@ def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -981,18 +946,17 @@ def create_by_id(
@overload
def create_by_id(
- self, role_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1000,25 +964,22 @@ def create_by_id(
@distributed_trace
def create_by_id(
- self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self, role_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]], **kwargs: Any
) -> _models.RoleAssignment:
"""Creates a role assignment by ID.
:param role_id: The ID of the role assignment to create. Required.
:type role_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1043,22 +1004,20 @@ def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_id=role_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -1068,14 +1027,12 @@ def create_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any) -> _models.RoleAssignment:
@@ -1085,12 +1042,11 @@ def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any
:type role_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1106,20 +1062,18 @@ def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -1129,14 +1083,12 @@ def get_by_id(self, role_id: str, tenant_id: Optional[str] = None, **kwargs: Any
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(
@@ -1150,7 +1102,6 @@ def list(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -1164,7 +1115,7 @@ def list(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1175,17 +1126,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_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
@@ -1196,14 +1145,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("RoleAssignmentListResult", pipeline_response)
@@ -1213,11 +1161,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
@@ -1230,8 +1178,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -1246,7 +1192,6 @@ def list_for_scope(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment]
@@ -1260,7 +1205,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1271,17 +1216,15 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -1292,14 +1235,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("RoleAssignmentListResult", pipeline_response)
@@ -1309,11 +1251,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
@@ -1325,5 +1267,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_client.py
index 639e414d454d..cab47eee9515 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_authorization_management_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
@@ -28,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -78,7 +80,25 @@ def __init__(
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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, "2020-10-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
@@ -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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_configuration.py
index aea735ace4db..a043c66782b1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-10-01")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_metadata.json
index 29397fd61b07..6187d0bf01a5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -88,8 +88,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": {
"eligible_child_resources": "EligibleChildResourcesOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_client.py
index 78cdb17387c6..694bc155461f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_authorization_management_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
@@ -28,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -78,7 +80,25 @@ def __init__(
self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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, "2020-10-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
@@ -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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_configuration.py
index 28344f73847e..871c73ffe8b7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-10-01")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py
index 31a4ba4b86ec..0aa8d3677b97 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/__init__.py
@@ -5,19 +5,25 @@
# 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 ._eligible_child_resources_operations import EligibleChildResourcesOperations
-from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations
-from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations
-from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations
-from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations
-from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations
-from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations
-from ._role_management_policies_operations import RoleManagementPoliciesOperations
-from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._eligible_child_resources_operations import EligibleChildResourcesOperations # type: ignore
+from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations # type: ignore
+from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations # type: ignore
+from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations # type: ignore
+from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations # type: ignore
+from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations # type: ignore
+from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations # type: ignore
+from ._role_management_policies_operations import RoleManagementPoliciesOperations # type: ignore
+from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations # 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__ = [
@@ -31,5 +37,5 @@
"RoleManagementPoliciesOperations",
"RoleManagementPolicyAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_resources_operations.py
index 474a0ebb9741..960087732b38 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_resources_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_eligible_child_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, 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._eligible_child_resources_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]]
@@ -66,7 +68,6 @@ def get(
$filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource
of type = 'Subscription' or 'ResourceGroup'. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either EligibleChildResource or the result of
cls(response)
:rtype:
@@ -79,7 +80,7 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,16 +91,14 @@ def get(
def prepare_request(next_link=None):
if not next_link:
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
filter=filter,
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)
else:
# make call to next link with the client's api-version
@@ -110,14 +109,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("EligibleChildResourcesListResult", pipeline_response)
@@ -127,11 +125,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
@@ -142,5 +140,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_operations.py
index ebcb4e78ea7f..2173e95b2479 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_instances_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,22 +19,24 @@
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._role_assignment_schedule_instances_operations import build_get_request, build_list_for_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]]
-class RoleAssignmentScheduleInstancesOperations:
+class RoleAssignmentScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -58,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignmentScheduleInstance"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule instances of a role assignment schedule.
:param scope: The scope of the role assignment schedule. Required.
@@ -69,7 +72,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedule instances created for the current
user. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleInstance or the result of
cls(response)
:rtype:
@@ -82,7 +84,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -93,16 +95,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -113,14 +113,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("RoleAssignmentScheduleInstanceListResult", pipeline_response)
@@ -130,11 +129,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
@@ -146,8 +145,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"}
-
@distributed_trace_async
async def get(
self, scope: str, role_assignment_schedule_instance_name: str, **kwargs: Any
@@ -159,12 +156,11 @@ async def get(
:param role_assignment_schedule_instance_name: The name (hash of schedule name + time) of the
role assignment schedule to get. Required.
:type role_assignment_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -178,20 +174,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_instance_name=role_assignment_schedule_instance_name,
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
@@ -200,13 +194,9 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_operations.py
index 0ae5c5d9a086..ac107d6f4645 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedule_requests_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._role_assignment_schedule_requests_operations import (
build_cancel_request,
build_create_request,
@@ -37,6 +35,10 @@
build_validate_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]]
@@ -71,6 +73,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -88,7 +91,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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -99,11 +101,12 @@ async def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -117,11 +120,10 @@ async def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -132,9 +134,10 @@ async def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -148,18 +151,14 @@ async def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -182,23 +181,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -207,16 +204,12 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -229,12 +222,11 @@ async def get(
:param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule
request to get. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,20 +240,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
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
@@ -270,21 +260,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignmentScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule requests for a scope.
:param scope: The scope of the role assignments schedule requests. Required.
@@ -297,7 +284,6 @@ def list_for_scope(
for the current user. Use $filter=asApprover() to return all role assignment schedule requests
where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of
cls(response)
:rtype:
@@ -310,7 +296,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,16 +307,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -341,14 +325,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("RoleAssignmentScheduleRequestListResult", pipeline_response)
@@ -358,11 +341,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
@@ -374,12 +357,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"}
-
@distributed_trace_async
- async def cancel( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any
- ) -> None:
+ async def cancel(self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any) -> None:
"""Cancels a pending role assignment schedule request.
:param scope: The scope of the role assignment request to cancel. Required.
@@ -387,12 +366,11 @@ async def cancel( # pylint: disable=inconsistent-return-statements
:param role_assignment_schedule_request_name: The name of the role assignment request to
cancel. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -406,20 +384,18 @@ async def cancel( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -429,11 +405,7 @@ async def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def validate(
@@ -457,7 +429,6 @@ async def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -468,7 +439,7 @@ async def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -481,11 +452,10 @@ async def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -496,7 +466,7 @@ async def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
"""Validates a new role assignment schedule request.
@@ -507,18 +477,14 @@ async def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -541,23 +507,21 @@ async def validate(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -566,13 +530,9 @@ async def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_operations.py
index b3250239af59..60b1ba345472 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_assignment_schedules_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._role_assignment_schedules_operations import build_get_request, build_list_for_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]]
@@ -65,12 +67,11 @@ async def get(
:param role_assignment_schedule_name: The name (guid) of the role assignment schedule to get.
Required.
:type role_assignment_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentSchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentSchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,20 +85,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_name=role_assignment_schedule_name,
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
@@ -106,16 +105,12 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -132,7 +127,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentSchedule or the result of
cls(response)
:rtype:
@@ -145,7 +139,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -156,16 +150,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -176,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
async def extract_data(pipeline_response):
deserialized = self._deserialize("RoleAssignmentScheduleListResult", pipeline_response)
@@ -193,11 +184,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
@@ -208,5 +199,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_operations.py
index dab77c986c6a..eb7e8d86a157 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_instances_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,25 +19,27 @@
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._role_eligibility_schedule_instances_operations import (
build_get_request,
build_list_for_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]]
-class RoleEligibilityScheduleInstancesOperations:
+class RoleEligibilityScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -61,6 +63,7 @@ def __init__(self, *args, **kwargs) -> None:
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleEligibilityScheduleInstance"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule instances of a role eligibility schedule.
:param scope: The scope of the role eligibility schedule. Required.
@@ -72,7 +75,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleInstance or the result of
cls(response)
:rtype:
@@ -85,7 +87,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -96,16 +98,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -116,14 +116,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("RoleEligibilityScheduleInstanceListResult", pipeline_response)
@@ -133,11 +132,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
@@ -149,8 +148,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"}
-
@distributed_trace_async
async def get(
self, scope: str, role_eligibility_schedule_instance_name: str, **kwargs: Any
@@ -162,12 +159,11 @@ async def get(
:param role_eligibility_schedule_instance_name: The name (hash of schedule name + time) of the
role eligibility schedule to get. Required.
:type role_eligibility_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,20 +177,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_instance_name=role_eligibility_schedule_instance_name,
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
@@ -203,13 +197,9 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_operations.py
index 384a66bed66e..50c38f3f99a8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedule_requests_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._role_eligibility_schedule_requests_operations import (
build_cancel_request,
build_create_request,
@@ -37,11 +35,15 @@
build_validate_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 RoleEligibilityScheduleRequestsOperations:
+class RoleEligibilityScheduleRequestsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -71,6 +73,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -88,7 +91,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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -99,11 +101,12 @@ async def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -117,11 +120,10 @@ async def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -132,9 +134,10 @@ async def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -148,18 +151,14 @@ async def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -182,23 +181,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -207,16 +204,12 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -229,12 +222,11 @@ async def get(
:param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule
request to get. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,20 +240,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
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
@@ -270,21 +260,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleEligibilityScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule requests for a scope.
:param scope: The scope of the role eligibility schedule requests. Required.
@@ -297,7 +284,6 @@ def list_for_scope(
created for the current user. Use $filter=asApprover() to return all role eligibility schedule
requests where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of
cls(response)
:rtype:
@@ -310,7 +296,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,16 +307,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -341,14 +325,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("RoleEligibilityScheduleRequestListResult", pipeline_response)
@@ -358,11 +341,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
@@ -374,12 +357,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"}
-
@distributed_trace_async
- async def cancel( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any
- ) -> None:
+ async def cancel(self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any) -> None:
"""Cancels a pending role eligibility schedule request.
:param scope: The scope of the role eligibility request to cancel. Required.
@@ -387,12 +366,11 @@ async def cancel( # pylint: disable=inconsistent-return-statements
:param role_eligibility_schedule_request_name: The name of the role eligibility request to
cancel. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -406,20 +384,18 @@ async def cancel( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -429,11 +405,7 @@ async def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def validate(
@@ -457,7 +429,6 @@ async def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -468,7 +439,7 @@ async def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -481,11 +452,10 @@ async def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -496,7 +466,7 @@ async def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
"""Validates a new role eligibility schedule request.
@@ -507,18 +477,14 @@ async def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -541,23 +507,21 @@ async def validate(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -566,13 +530,9 @@ async def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_operations.py
index beeb9ff0e6db..f7cb89a5d814 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_eligibility_schedules_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._role_eligibility_schedules_operations import build_get_request, build_list_for_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]]
@@ -65,12 +67,11 @@ async def get(
:param role_eligibility_schedule_name: The name (guid) of the role eligibility schedule to get.
Required.
:type role_eligibility_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilitySchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilitySchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,20 +85,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_name=role_eligibility_schedule_name,
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
@@ -106,16 +105,12 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -132,7 +127,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilitySchedule or the result of
cls(response)
:rtype:
@@ -145,7 +139,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -156,16 +150,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -176,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
async def extract_data(pipeline_response):
deserialized = self._deserialize("RoleEligibilityScheduleListResult", pipeline_response)
@@ -193,11 +184,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
@@ -208,5 +199,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_operations.py
index 24d48258e4e8..07da5d7b7cb3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policies_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._role_management_policies_operations import (
build_delete_request,
build_get_request,
@@ -36,6 +34,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]]
@@ -69,12 +71,11 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any)
:param role_management_policy_name: The name (guid) of the role management policy to get.
Required.
:type role_management_policy_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,20 +89,18 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any)
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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
@@ -110,16 +109,12 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@overload
async def update(
@@ -143,7 +138,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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -154,7 +148,7 @@ async def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -167,11 +161,10 @@ async def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. 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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -182,7 +175,7 @@ async def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: Union[_models.RoleManagementPolicy, IO],
+ parameters: Union[_models.RoleManagementPolicy, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicy:
"""Update a role management policy.
@@ -193,17 +186,14 @@ async def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy
- type or a IO type. Required.
- :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy or
+ IO[bytes]
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -226,23 +216,21 @@ async def update(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicy")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -251,21 +239,15 @@ async def update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_management_policy_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> None:
"""Delete a role management policy.
:param scope: The scope of the role management policy to upsert. Required.
@@ -273,12 +255,11 @@ async def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_name: The name (guid) of the role management policy to upsert.
Required.
:type role_management_policy_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,
@@ -292,20 +273,18 @@ async def delete( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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
@@ -315,11 +294,7 @@ async def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicy"]:
@@ -327,7 +302,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicy or the result of
cls(response)
:rtype:
@@ -340,7 +314,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -351,15 +325,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -370,14 +342,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("RoleManagementPolicyListResult", pipeline_response)
@@ -387,11 +358,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
@@ -402,5 +373,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_operations.py
index c0d93ed66a45..3fe1d92f675b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/aio/operations/_role_management_policy_assignments_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._role_management_policy_assignments_operations import (
build_create_request,
build_delete_request,
@@ -36,11 +34,15 @@
build_list_for_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]]
-class RoleManagementPolicyAssignmentsOperations:
+class RoleManagementPolicyAssignmentsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -71,12 +73,11 @@ async def get(
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to get. Required.
:type role_management_policy_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,20 +91,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -112,16 +111,12 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@overload
async def create(
@@ -145,7 +140,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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -156,7 +150,7 @@ async def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -169,11 +163,10 @@ async def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. 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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -184,7 +177,7 @@ async def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: Union[_models.RoleManagementPolicyAssignment, IO],
+ parameters: Union[_models.RoleManagementPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicyAssignment:
"""Create a role management policy assignment.
@@ -195,18 +188,14 @@ async def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. Is either a
- RoleManagementPolicyAssignment type or a IO type. Required.
+ RoleManagementPolicyAssignment type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -229,23 +218,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicyAssignment")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -254,21 +241,15 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_management_policy_assignment_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, scope: str, role_management_policy_assignment_name: str, **kwargs: Any) -> None:
"""Delete a role management policy assignment.
:param scope: The scope of the role management policy assignment to delete. Required.
@@ -276,12 +257,11 @@ async def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to delete. Required.
:type role_management_policy_assignment_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,
@@ -295,20 +275,18 @@ async def delete( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -318,19 +296,15 @@ async def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicyAssignment"]:
+ # pylint: disable=line-too-long
"""Gets role management assignment policies for a resource scope.
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicyAssignment or the result of
cls(response)
:rtype:
@@ -343,7 +317,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -354,15 +328,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -373,14 +345,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("RoleManagementPolicyAssignmentListResult", pipeline_response)
@@ -390,11 +361,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
@@ -405,5 +376,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py
index 1f18506a6b36..200a7c173219 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/__init__.py
@@ -5,76 +5,87 @@
# 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 ApprovalSettings
-from ._models_py3 import ApprovalStage
-from ._models_py3 import CloudErrorBody
-from ._models_py3 import EligibleChildResource
-from ._models_py3 import EligibleChildResourcesListResult
-from ._models_py3 import ExpandedProperties
-from ._models_py3 import ExpandedPropertiesPrincipal
-from ._models_py3 import ExpandedPropertiesRoleDefinition
-from ._models_py3 import ExpandedPropertiesScope
-from ._models_py3 import Permission
-from ._models_py3 import PolicyAssignmentProperties
-from ._models_py3 import PolicyAssignmentPropertiesPolicy
-from ._models_py3 import PolicyAssignmentPropertiesRoleDefinition
-from ._models_py3 import PolicyAssignmentPropertiesScope
-from ._models_py3 import PolicyProperties
-from ._models_py3 import PolicyPropertiesScope
-from ._models_py3 import Principal
-from ._models_py3 import RoleAssignmentSchedule
-from ._models_py3 import RoleAssignmentScheduleFilter
-from ._models_py3 import RoleAssignmentScheduleInstance
-from ._models_py3 import RoleAssignmentScheduleInstanceFilter
-from ._models_py3 import RoleAssignmentScheduleInstanceListResult
-from ._models_py3 import RoleAssignmentScheduleListResult
-from ._models_py3 import RoleAssignmentScheduleRequest
-from ._models_py3 import RoleAssignmentScheduleRequestFilter
-from ._models_py3 import RoleAssignmentScheduleRequestListResult
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfo
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesTicketInfo
-from ._models_py3 import RoleEligibilitySchedule
-from ._models_py3 import RoleEligibilityScheduleFilter
-from ._models_py3 import RoleEligibilityScheduleInstance
-from ._models_py3 import RoleEligibilityScheduleInstanceFilter
-from ._models_py3 import RoleEligibilityScheduleInstanceListResult
-from ._models_py3 import RoleEligibilityScheduleListResult
-from ._models_py3 import RoleEligibilityScheduleRequest
-from ._models_py3 import RoleEligibilityScheduleRequestFilter
-from ._models_py3 import RoleEligibilityScheduleRequestListResult
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfo
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesTicketInfo
-from ._models_py3 import RoleManagementPolicy
-from ._models_py3 import RoleManagementPolicyApprovalRule
-from ._models_py3 import RoleManagementPolicyAssignment
-from ._models_py3 import RoleManagementPolicyAssignmentListResult
-from ._models_py3 import RoleManagementPolicyAuthenticationContextRule
-from ._models_py3 import RoleManagementPolicyEnablementRule
-from ._models_py3 import RoleManagementPolicyExpirationRule
-from ._models_py3 import RoleManagementPolicyListResult
-from ._models_py3 import RoleManagementPolicyNotificationRule
-from ._models_py3 import RoleManagementPolicyRule
-from ._models_py3 import RoleManagementPolicyRuleTarget
-from ._models_py3 import UserSet
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import ApprovalMode
-from ._authorization_management_client_enums import AssignmentType
-from ._authorization_management_client_enums import EnablementRules
-from ._authorization_management_client_enums import MemberType
-from ._authorization_management_client_enums import NotificationDeliveryMechanism
-from ._authorization_management_client_enums import NotificationLevel
-from ._authorization_management_client_enums import PrincipalType
-from ._authorization_management_client_enums import RecipientType
-from ._authorization_management_client_enums import RequestType
-from ._authorization_management_client_enums import RoleManagementPolicyRuleType
-from ._authorization_management_client_enums import Status
-from ._authorization_management_client_enums import Type
-from ._authorization_management_client_enums import UserType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ApprovalSettings,
+ ApprovalStage,
+ CloudErrorBody,
+ EligibleChildResource,
+ EligibleChildResourcesListResult,
+ ExpandedProperties,
+ ExpandedPropertiesPrincipal,
+ ExpandedPropertiesRoleDefinition,
+ ExpandedPropertiesScope,
+ Permission,
+ PolicyAssignmentProperties,
+ PolicyAssignmentPropertiesPolicy,
+ PolicyAssignmentPropertiesRoleDefinition,
+ PolicyAssignmentPropertiesScope,
+ PolicyProperties,
+ PolicyPropertiesScope,
+ Principal,
+ RoleAssignmentSchedule,
+ RoleAssignmentScheduleFilter,
+ RoleAssignmentScheduleInstance,
+ RoleAssignmentScheduleInstanceFilter,
+ RoleAssignmentScheduleInstanceListResult,
+ RoleAssignmentScheduleListResult,
+ RoleAssignmentScheduleRequest,
+ RoleAssignmentScheduleRequestFilter,
+ RoleAssignmentScheduleRequestListResult,
+ RoleAssignmentScheduleRequestPropertiesScheduleInfo,
+ RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration,
+ RoleAssignmentScheduleRequestPropertiesTicketInfo,
+ RoleEligibilitySchedule,
+ RoleEligibilityScheduleFilter,
+ RoleEligibilityScheduleInstance,
+ RoleEligibilityScheduleInstanceFilter,
+ RoleEligibilityScheduleInstanceListResult,
+ RoleEligibilityScheduleListResult,
+ RoleEligibilityScheduleRequest,
+ RoleEligibilityScheduleRequestFilter,
+ RoleEligibilityScheduleRequestListResult,
+ RoleEligibilityScheduleRequestPropertiesScheduleInfo,
+ RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration,
+ RoleEligibilityScheduleRequestPropertiesTicketInfo,
+ RoleManagementPolicy,
+ RoleManagementPolicyApprovalRule,
+ RoleManagementPolicyAssignment,
+ RoleManagementPolicyAssignmentListResult,
+ RoleManagementPolicyAuthenticationContextRule,
+ RoleManagementPolicyEnablementRule,
+ RoleManagementPolicyExpirationRule,
+ RoleManagementPolicyListResult,
+ RoleManagementPolicyNotificationRule,
+ RoleManagementPolicyRule,
+ RoleManagementPolicyRuleTarget,
+ UserSet,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ ApprovalMode,
+ AssignmentType,
+ EnablementRules,
+ MemberType,
+ NotificationDeliveryMechanism,
+ NotificationLevel,
+ PrincipalType,
+ RecipientType,
+ RequestType,
+ RoleManagementPolicyRuleType,
+ Status,
+ Type,
+ UserType,
+)
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__ = [
@@ -145,5 +156,5 @@
"Type",
"UserType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/_models_py3.py
index bdd139feaa79..1044cb868c53 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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.
@@ -13,7 +13,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -718,7 +717,7 @@ def __init__(
self.email = email
-class RoleAssignmentSchedule(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentSchedule(_serialization.Model):
"""Role Assignment schedule.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -933,7 +932,7 @@ def __init__(
self.status = status
-class RoleAssignmentScheduleInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentScheduleInstance(_serialization.Model):
"""Information about current or upcoming role assignment schedule instance.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1233,7 +1232,7 @@ def __init__(
self.next_link = next_link
-class RoleAssignmentScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentScheduleRequest(_serialization.Model):
"""Role Assignment schedule request.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1495,7 +1494,7 @@ def __init__(
self.next_link = next_link
-class RoleAssignmentScheduleRequestPropertiesScheduleInfo(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesScheduleInfo(_serialization.Model): # pylint: disable=name-too-long
"""Schedule info of the role assignment schedule.
:ivar start_date_time: Start DateTime of the role assignment schedule.
@@ -1529,7 +1528,9 @@ def __init__(
self.expiration = expiration
-class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(
+ _serialization.Model
+): # pylint: disable=name-too-long
"""Expiration of the role assignment schedule.
:ivar type: Type of the role assignment schedule expiration. Known values are: "AfterDuration",
@@ -1570,7 +1571,7 @@ def __init__(
self.duration = duration
-class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model): # pylint: disable=name-too-long
"""Ticket Info of the role assignment.
:ivar ticket_number: Ticket number for the role assignment.
@@ -1598,7 +1599,7 @@ def __init__(
self.ticket_system = ticket_system
-class RoleEligibilitySchedule(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleEligibilitySchedule(_serialization.Model):
"""Role eligibility schedule.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1795,7 +1796,7 @@ def __init__(
self.status = status
-class RoleEligibilityScheduleInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleEligibilityScheduleInstance(_serialization.Model):
"""Information about current or upcoming role eligibility schedule instance.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1994,7 +1995,7 @@ def __init__(
self.role_eligibility_schedule_id = role_eligibility_schedule_id
-class RoleEligibilityScheduleInstanceListResult(_serialization.Model):
+class RoleEligibilityScheduleInstanceListResult(_serialization.Model): # pylint: disable=name-too-long
"""Role eligibility schedule instance list operation result.
:ivar value: Role eligibility schedule instance list.
@@ -2060,7 +2061,7 @@ def __init__(
self.next_link = next_link
-class RoleEligibilityScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleEligibilityScheduleRequest(_serialization.Model):
"""Role Eligibility schedule request.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2313,7 +2314,7 @@ def __init__(
self.next_link = next_link
-class RoleEligibilityScheduleRequestPropertiesScheduleInfo(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesScheduleInfo(_serialization.Model): # pylint: disable=name-too-long
"""Schedule info of the role eligibility schedule.
:ivar start_date_time: Start DateTime of the role eligibility schedule.
@@ -2347,7 +2348,9 @@ def __init__(
self.expiration = expiration
-class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(
+ _serialization.Model
+): # pylint: disable=name-too-long
"""Expiration of the role eligibility schedule.
:ivar type: Type of the role eligibility schedule expiration. Known values are:
@@ -2388,7 +2391,7 @@ def __init__(
self.duration = duration
-class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model): # pylint: disable=name-too-long
"""Ticket Info of the role eligibility.
:ivar ticket_number: Ticket number for the role eligibility.
@@ -2416,7 +2419,7 @@ def __init__(
self.ticket_system = ticket_system
-class RoleManagementPolicy(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleManagementPolicy(_serialization.Model):
"""Role management policy.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2518,7 +2521,7 @@ class RoleManagementPolicyRule(_serialization.Model):
RoleManagementPolicyEnablementRule, RoleManagementPolicyExpirationRule,
RoleManagementPolicyNotificationRule
- 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: The id of the rule.
:vartype id: str
@@ -2574,7 +2577,7 @@ def __init__(
class RoleManagementPolicyApprovalRule(RoleManagementPolicyRule):
"""The role management policy approval rule.
- 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: The id of the rule.
:vartype id: str
@@ -2730,10 +2733,10 @@ def __init__(
self.next_link = next_link
-class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule):
+class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule): # pylint: disable=name-too-long
"""The role management policy authentication context rule.
- 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: The id of the rule.
:vartype id: str
@@ -2791,7 +2794,7 @@ def __init__(
class RoleManagementPolicyEnablementRule(RoleManagementPolicyRule):
"""The role management policy enablement rule.
- 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: The id of the rule.
:vartype id: str
@@ -2844,7 +2847,7 @@ def __init__(
class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule):
"""The role management policy expiration rule.
- 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: The id of the rule.
:vartype id: str
@@ -2934,7 +2937,7 @@ def __init__(
class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule):
"""The role management policy notification rule.
- 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: The id of the rule.
:vartype id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py
index 31a4ba4b86ec..0aa8d3677b97 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/__init__.py
@@ -5,19 +5,25 @@
# 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 ._eligible_child_resources_operations import EligibleChildResourcesOperations
-from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations
-from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations
-from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations
-from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations
-from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations
-from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations
-from ._role_management_policies_operations import RoleManagementPoliciesOperations
-from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._eligible_child_resources_operations import EligibleChildResourcesOperations # type: ignore
+from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations # type: ignore
+from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations # type: ignore
+from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations # type: ignore
+from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations # type: ignore
+from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations # type: ignore
+from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations # type: ignore
+from ._role_management_policies_operations import RoleManagementPoliciesOperations # type: ignore
+from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations # 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__ = [
@@ -31,5 +37,5 @@
"RoleManagementPoliciesOperations",
"RoleManagementPolicyAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py
index 91c9a599883e..10a1c740b2fc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_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, 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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -93,7 +95,6 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab
$filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource
of type = 'Subscription' or 'ResourceGroup'. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either EligibleChildResource or the result of
cls(response)
:rtype:
@@ -106,7 +107,7 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -117,16 +118,14 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab
def prepare_request(next_link=None):
if not next_link:
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
filter=filter,
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)
else:
# make call to next link with the client's api-version
@@ -137,14 +136,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("EligibleChildResourcesListResult", pipeline_response)
@@ -154,11 +152,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
@@ -169,5 +167,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py
index e8ca1d811b0b..0894dceab6ff 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -81,7 +83,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, *
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -92,7 +94,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, *
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleAssignmentScheduleInstancesOperations:
+class RoleAssignmentScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -127,7 +129,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedule instances created for the current
user. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleInstance or the result of
cls(response)
:rtype:
@@ -140,7 +141,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -151,16 +152,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -171,14 +170,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("RoleAssignmentScheduleInstanceListResult", pipeline_response)
@@ -188,11 +186,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
@@ -204,8 +202,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"}
-
@distributed_trace
def get(
self, scope: str, role_assignment_schedule_instance_name: str, **kwargs: Any
@@ -217,12 +213,11 @@ def get(
:param role_assignment_schedule_instance_name: The name (hash of schedule name + time) of the
role assignment schedule to get. Required.
:type role_assignment_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -236,20 +231,18 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_instance_name=role_assignment_schedule_instance_name,
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
@@ -258,13 +251,9 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py
index 542edabc6b52..82002cb6a717 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_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, _format_url_section
+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]]
@@ -57,7 +59,7 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,7 +91,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, **
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,7 +115,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -145,7 +147,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -176,7 +178,7 @@ def build_validate_request(scope: str, role_assignment_schedule_request_name: st
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -219,6 +221,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -236,7 +239,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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -247,11 +249,12 @@ def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -265,11 +268,10 @@ def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -280,9 +282,10 @@ def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -296,18 +299,14 @@ def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -330,23 +329,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -355,16 +352,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -377,12 +370,11 @@ def get(
:param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule
request to get. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,20 +388,18 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
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
@@ -418,16 +408,12 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -445,7 +431,6 @@ def list_for_scope(
for the current user. Use $filter=asApprover() to return all role assignment schedule requests
where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of
cls(response)
:rtype:
@@ -458,7 +443,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -469,16 +454,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -489,14 +472,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("RoleAssignmentScheduleRequestListResult", pipeline_response)
@@ -506,11 +488,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
@@ -522,8 +504,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"}
-
@distributed_trace
def cancel( # pylint: disable=inconsistent-return-statements
self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any
@@ -535,12 +515,11 @@ def cancel( # pylint: disable=inconsistent-return-statements
:param role_assignment_schedule_request_name: The name of the role assignment request to
cancel. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -554,20 +533,18 @@ def cancel( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -577,11 +554,7 @@ def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def validate(
@@ -605,7 +578,6 @@ def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -616,7 +588,7 @@ def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -629,11 +601,10 @@ def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -644,7 +615,7 @@ def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
"""Validates a new role assignment schedule request.
@@ -655,18 +626,14 @@ def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -689,23 +656,21 @@ def validate(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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,13 +679,9 @@ def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py
index a6edd5760f1b..1a756aeedc0c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs:
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -121,12 +123,11 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) ->
:param role_assignment_schedule_name: The name (guid) of the role assignment schedule to get.
Required.
:type role_assignment_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentSchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleAssignmentSchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -140,20 +141,18 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) ->
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_name=role_assignment_schedule_name,
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
@@ -162,16 +161,12 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) ->
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -188,7 +183,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentSchedule or the result of
cls(response)
:rtype:
@@ -201,7 +195,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,16 +206,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -232,14 +224,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("RoleAssignmentScheduleListResult", pipeline_response)
@@ -249,11 +240,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
@@ -264,5 +255,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py
index 84baa462231c..138d0cc633a9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -81,7 +83,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -92,7 +94,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str,
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleEligibilityScheduleInstancesOperations:
+class RoleEligibilityScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -127,7 +129,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleInstance or the result of
cls(response)
:rtype:
@@ -140,7 +141,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -151,16 +152,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -171,14 +170,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("RoleEligibilityScheduleInstanceListResult", pipeline_response)
@@ -188,11 +186,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
@@ -204,8 +202,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"}
-
@distributed_trace
def get(
self, scope: str, role_eligibility_schedule_instance_name: str, **kwargs: Any
@@ -217,12 +213,11 @@ def get(
:param role_eligibility_schedule_instance_name: The name (hash of schedule name + time) of the
role eligibility schedule to get. Required.
:type role_eligibility_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -236,20 +231,18 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_instance_name=role_eligibility_schedule_instance_name,
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
@@ -258,13 +251,9 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py
index 03cb9acf3abe..6e11163f691a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_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, _format_url_section
+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]]
@@ -57,7 +59,7 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,7 +91,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, *
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,7 +115,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -145,7 +147,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -176,7 +178,7 @@ def build_validate_request(scope: str, role_eligibility_schedule_request_name: s
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -189,7 +191,7 @@ def build_validate_request(scope: str, role_eligibility_schedule_request_name: s
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleEligibilityScheduleRequestsOperations:
+class RoleEligibilityScheduleRequestsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -219,6 +221,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -236,7 +239,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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -247,11 +249,12 @@ def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -265,11 +268,10 @@ def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -280,9 +282,10 @@ def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -296,18 +299,14 @@ def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -330,23 +329,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -355,16 +352,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -377,12 +370,11 @@ def get(
:param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule
request to get. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,20 +388,18 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
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
@@ -418,16 +408,12 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -445,7 +431,6 @@ def list_for_scope(
created for the current user. Use $filter=asApprover() to return all role eligibility schedule
requests where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of
cls(response)
:rtype:
@@ -458,7 +443,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -469,16 +454,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -489,14 +472,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("RoleEligibilityScheduleRequestListResult", pipeline_response)
@@ -506,11 +488,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
@@ -522,8 +504,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"}
-
@distributed_trace
def cancel( # pylint: disable=inconsistent-return-statements
self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any
@@ -535,12 +515,11 @@ def cancel( # pylint: disable=inconsistent-return-statements
:param role_eligibility_schedule_request_name: The name of the role eligibility request to
cancel. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -554,20 +533,18 @@ def cancel( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -577,11 +554,7 @@ def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def validate(
@@ -605,7 +578,6 @@ def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -616,7 +588,7 @@ def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -629,11 +601,10 @@ def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -644,7 +615,7 @@ def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
"""Validates a new role eligibility schedule request.
@@ -655,18 +626,14 @@ def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -689,23 +656,21 @@ def validate(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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,13 +679,9 @@ def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py
index 9d7ba4e73c05..f54852110c9a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs:
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -121,12 +123,11 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) ->
:param role_eligibility_schedule_name: The name (guid) of the role eligibility schedule to get.
Required.
:type role_eligibility_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilitySchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleEligibilitySchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -140,20 +141,18 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) ->
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_name=role_eligibility_schedule_name,
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
@@ -162,16 +161,12 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) ->
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -188,7 +183,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilitySchedule or the result of
cls(response)
:rtype:
@@ -201,7 +195,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,16 +206,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -232,14 +224,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("RoleEligibilityScheduleListResult", pipeline_response)
@@ -249,11 +240,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
@@ -264,5 +255,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py
index 57aa735de0b9..8f00cb06d5e9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An
"roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +83,7 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs:
"roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -110,7 +112,7 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs:
"roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -134,7 +136,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -174,12 +176,11 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m
:param role_management_policy_name: The name (guid) of the role management policy to get.
Required.
:type role_management_policy_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -193,20 +194,18 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@overload
def update(
@@ -248,7 +243,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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -259,7 +253,7 @@ def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -272,11 +266,10 @@ def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. 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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -287,7 +280,7 @@ def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: Union[_models.RoleManagementPolicy, IO],
+ parameters: Union[_models.RoleManagementPolicy, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicy:
"""Update a role management policy.
@@ -298,17 +291,14 @@ def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy
- type or a IO type. Required.
- :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ type or a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy or
+ IO[bytes]
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -331,23 +321,21 @@ def update(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicy")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -356,16 +344,12 @@ def update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
@@ -378,12 +362,11 @@ def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_name: The name (guid) of the role management policy to upsert.
Required.
:type role_management_policy_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,
@@ -397,20 +380,18 @@ def delete( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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
@@ -420,11 +401,7 @@ def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicy"]:
@@ -432,7 +409,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicy or the result of
cls(response)
:rtype:
@@ -445,7 +421,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -456,15 +432,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -475,14 +449,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("RoleManagementPolicyListResult", pipeline_response)
@@ -492,11 +465,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
@@ -507,5 +480,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py
index d15880273785..4fcd025a0b20 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, *
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -119,7 +121,7 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -143,7 +145,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -154,7 +156,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleManagementPolicyAssignmentsOperations:
+class RoleManagementPolicyAssignmentsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -185,12 +187,11 @@ def get(
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to get. Required.
:type role_management_policy_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -204,20 +205,18 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -226,16 +225,12 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@overload
def create(
@@ -259,7 +254,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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -270,7 +264,7 @@ def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -283,11 +277,10 @@ def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. 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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -298,7 +291,7 @@ def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: Union[_models.RoleManagementPolicyAssignment, IO],
+ parameters: Union[_models.RoleManagementPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicyAssignment:
"""Create a role management policy assignment.
@@ -309,18 +302,14 @@ def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. Is either a
- RoleManagementPolicyAssignment type or a IO type. Required.
+ RoleManagementPolicyAssignment type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -343,23 +332,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicyAssignment")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -368,16 +355,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
@@ -390,12 +373,11 @@ def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to delete. Required.
:type role_management_policy_assignment_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,
@@ -409,20 +391,18 @@ def delete( # pylint: disable=inconsistent-return-statements
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -432,11 +412,7 @@ def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicyAssignment"]:
@@ -444,7 +420,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicyAssignment or the result of
cls(response)
:rtype:
@@ -457,7 +432,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-10-01"))
cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -468,15 +443,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -487,14 +460,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("RoleManagementPolicyAssignmentListResult", pipeline_response)
@@ -504,11 +476,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
@@ -519,5 +491,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_client.py
index 1673bed51664..2453fd12a68f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -90,7 +92,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -127,7 +147,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
@@ -147,12 +167,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_configuration.py
index a86bb2b1c86e..16ccfe2359fd 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-10-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_metadata.json
index 90e687cae95a..5f9190f744f4 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/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": 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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"role_assignments": "RoleAssignmentsOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/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 = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_client.py
index b489128766ea..7ed73e9d835a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -90,7 +92,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -127,7 +147,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
@@ -147,12 +169,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_configuration.py
index bcfc50b7f475..bbcc6fd267cc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2020-10-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/__init__.py
index c2480d05193e..34d8eaf4c975 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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 ._role_assignments_operations import RoleAssignmentsOperations
-from ._eligible_child_resources_operations import EligibleChildResourcesOperations
-from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations
-from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations
-from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations
-from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations
-from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations
-from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations
-from ._role_management_policies_operations import RoleManagementPoliciesOperations
-from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._eligible_child_resources_operations import EligibleChildResourcesOperations # type: ignore
+from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations # type: ignore
+from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations # type: ignore
+from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations # type: ignore
+from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations # type: ignore
+from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations # type: ignore
+from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations # type: ignore
+from ._role_management_policies_operations import RoleManagementPoliciesOperations # type: ignore
+from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations # 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 @@
"RoleManagementPoliciesOperations",
"RoleManagementPolicyAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_resources_operations.py
index bd707b2c4a44..b633ef5d7236 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_resources_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_eligible_child_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, 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._eligible_child_resources_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]]
@@ -57,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None:
def get(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.EligibleChildResource"]:
+ # pylint: disable=line-too-long
"""Get the child resources of a resource on which user has eligible access.
:param scope: The scope of the role management policy. Required.
@@ -66,7 +69,6 @@ def get(
$filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource
of type = 'Subscription' or 'ResourceGroup'. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either EligibleChildResource or the result of
cls(response)
:rtype:
@@ -81,7 +83,7 @@ def get(
)
cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -92,16 +94,14 @@ def get(
def prepare_request(next_link=None):
if not next_link:
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
filter=filter,
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)
else:
# make call to next link with the client's api-version
@@ -112,14 +112,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("EligibleChildResourcesListResult", pipeline_response)
@@ -129,11 +128,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
@@ -144,5 +143,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_operations.py
index c843d2b73cbc..005022463801 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_instances_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,22 +19,24 @@
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._role_assignment_schedule_instances_operations import build_get_request, build_list_for_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]]
-class RoleAssignmentScheduleInstancesOperations:
+class RoleAssignmentScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -58,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignmentScheduleInstance"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule instances of a role assignment schedule.
:param scope: The scope of the role assignment schedule. Required.
@@ -69,7 +72,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedule instances created for the current
user. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleInstance or the result of
cls(response)
:rtype:
@@ -84,7 +86,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,16 +97,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
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("RoleAssignmentScheduleInstanceListResult", 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,8 +147,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"}
-
@distributed_trace_async
async def get(
self, scope: str, role_assignment_schedule_instance_name: str, **kwargs: Any
@@ -161,12 +158,11 @@ async def get(
:param role_assignment_schedule_instance_name: The name (hash of schedule name + time) of the
role assignment schedule to get. Required.
:type role_assignment_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -182,20 +178,18 @@ async def get(
)
cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_instance_name=role_assignment_schedule_instance_name,
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
@@ -204,13 +198,9 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py
index 7149df82ace8..1bce1ef8d926 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedule_requests_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._role_assignment_schedule_requests_operations import (
build_cancel_request,
build_create_request,
@@ -36,6 +34,10 @@
build_list_for_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]]
@@ -70,6 +72,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -89,7 +92,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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -100,11 +102,12 @@ async def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -119,11 +122,10 @@ async def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -134,9 +136,10 @@ async def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -151,18 +154,14 @@ async def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest or IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,23 +186,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -212,16 +209,12 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -234,12 +227,11 @@ async def get(
:param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule
request to get. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -255,20 +247,18 @@ async def get(
)
cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
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
@@ -277,21 +267,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignmentScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule requests for a scope.
:param scope: The scope of the role assignments schedule requests. Required.
@@ -304,7 +291,6 @@ def list_for_scope(
for the current user. Use $filter=asApprover() to return all role assignment schedule requests
where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of
cls(response)
:rtype:
@@ -319,7 +305,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -330,16 +316,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -350,14 +334,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("RoleAssignmentScheduleRequestListResult", pipeline_response)
@@ -367,11 +350,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
@@ -383,12 +366,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"}
-
@distributed_trace_async
- async def cancel( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any
- ) -> None:
+ async def cancel(self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any) -> None:
"""Cancels a pending role assignment schedule request.
:param scope: The scope of the role assignment request to cancel. Required.
@@ -396,12 +375,11 @@ async def cancel( # pylint: disable=inconsistent-return-statements
:param role_assignment_schedule_request_name: The name of the role assignment request to
cancel. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -417,20 +395,18 @@ async def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -440,8 +416,4 @@ async def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_operations.py
index b44a610ed4b9..9c10dbfcc4b1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignment_schedules_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._role_assignment_schedules_operations import build_get_request, build_list_for_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]]
@@ -65,12 +67,11 @@ async def get(
:param role_assignment_schedule_name: The name (guid) of the role assignment schedule to get.
Required.
:type role_assignment_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentSchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentSchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,20 +87,18 @@ async def get(
)
cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_name=role_assignment_schedule_name,
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
@@ -108,21 +107,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignmentSchedule"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedules for a resource scope.
:param scope: The scope of the role assignments schedules. Required.
@@ -134,7 +130,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentSchedule or the result of
cls(response)
:rtype:
@@ -149,7 +144,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -160,16 +155,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -180,14 +173,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("RoleAssignmentScheduleListResult", pipeline_response)
@@ -197,11 +189,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
@@ -212,5 +204,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py
index 2c57a419901d..786a26d721d9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_assignments_operations.py
@@ -7,6 +7,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 +21,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._role_assignments_operations import (
build_create_by_id_request,
build_create_request,
@@ -44,6 +43,10 @@
build_validate_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,7 +83,6 @@ def list_for_subscription(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -94,7 +96,7 @@ def list_for_subscription(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,17 +107,15 @@ def list_for_subscription(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_subscription_request(
+ _request = build_list_for_subscription_request(
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_subscription.metadata["url"],
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("RoleAssignmentListResult", 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_for_subscription.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -179,7 +174,6 @@ def list_for_resource_group(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -193,7 +187,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -204,18 +198,16 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -226,14 +218,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("RoleAssignmentListResult", pipeline_response)
@@ -243,11 +234,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
@@ -260,10 +251,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -293,7 +280,6 @@ def list_for_resource(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -307,7 +293,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -318,7 +304,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
resource_type=resource_type,
@@ -327,12 +313,10 @@ def prepare_request(next_link=None):
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -343,14 +327,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("RoleAssignmentListResult", pipeline_response)
@@ -360,11 +343,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
@@ -377,14 +360,11 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace_async
async def get(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Get a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -398,12 +378,11 @@ async def get(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -419,21 +398,19 @@ async def get(
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -443,14 +420,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("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
async def create(
@@ -462,6 +437,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -479,7 +455,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -490,11 +465,12 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -507,11 +483,10 @@ async def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -522,9 +497,10 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -537,18 +513,15 @@ async def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -573,23 +546,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -599,23 +570,18 @@ async def create(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
-
@distributed_trace_async
async def delete(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> Optional[_models.RoleAssignment]:
+ # pylint: disable=line-too-long
"""Delete a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -629,12 +595,11 @@ async def delete(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -650,21 +615,19 @@ async def delete(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -676,14 +639,12 @@ async def delete(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
async def validate(
@@ -695,6 +656,7 @@ async def validate(
content_type: str = "application/json",
**kwargs: Any
) -> _models.ValidationResponse:
+ # pylint: disable=line-too-long
"""Validate a role assignment create or update operation by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -712,7 +674,6 @@ async def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -723,11 +684,12 @@ async def validate(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ValidationResponse:
+ # pylint: disable=line-too-long
"""Validate a role assignment create or update operation by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -740,11 +702,10 @@ async def validate(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -755,9 +716,10 @@ async def validate(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.ValidationResponse:
+ # pylint: disable=line-too-long
"""Validate a role assignment create or update operation by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -770,18 +732,15 @@ async def validate(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -806,23 +765,21 @@ async def validate(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -832,21 +789,18 @@ async def validate(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ValidationResponse", pipeline_response)
+ deserialized = self._deserialize("ValidationResponse", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignment"]:
+ # pylint: disable=line-too-long
"""List all role assignments that apply to a scope.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -861,7 +815,6 @@ def list_for_scope(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -875,7 +828,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -886,17 +839,15 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -907,14 +858,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("RoleAssignmentListResult", pipeline_response)
@@ -924,11 +874,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,8 +891,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace_async
async def get_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -952,17 +900,17 @@ async def get_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -978,20 +926,18 @@ async def get_by_id(
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -1001,14 +947,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
async def create_by_id(
@@ -1024,8 +968,9 @@ async def create_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Required.
:type parameters:
@@ -1033,7 +978,6 @@ async def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1041,22 +985,22 @@ async def create_by_id(
@overload
async def create_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1064,29 +1008,30 @@ async def create_by_id(
@distributed_trace_async
async def create_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1111,22 +1056,20 @@ async def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -1136,19 +1079,13 @@ async def create_by_id(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_by_id.metadata = {"url": "/{roleAssignmentId}"}
-
@distributed_trace_async
async def delete_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -1158,17 +1095,17 @@ async def delete_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1184,20 +1121,18 @@ async def delete_by_id(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -1209,14 +1144,12 @@ async def delete_by_id(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
async def validate_by_id(
@@ -1232,8 +1165,9 @@ async def validate_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Required.
:type parameters:
@@ -1241,7 +1175,6 @@ async def validate_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1249,22 +1182,22 @@ async def validate_by_id(
@overload
async def validate_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.ValidationResponse:
"""Validate a role assignment create or update operation by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1272,29 +1205,30 @@ async def validate_by_id(
@distributed_trace_async
async def validate_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.ValidationResponse:
"""Validate a role assignment create or update operation by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1319,22 +1253,20 @@ async def validate_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_validate_by_id_request(
+ _request = build_validate_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate_by_id.metadata["url"],
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
@@ -1344,11 +1276,9 @@ async def validate_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ValidationResponse", pipeline_response)
+ deserialized = self._deserialize("ValidationResponse", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate_by_id.metadata = {"url": "/{roleAssignmentId}/validate"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_operations.py
index 6561dfb24dd5..d8c39cee97df 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_instances_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,25 +19,27 @@
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._role_eligibility_schedule_instances_operations import (
build_get_request,
build_list_for_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]]
-class RoleEligibilityScheduleInstancesOperations:
+class RoleEligibilityScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -61,6 +63,7 @@ def __init__(self, *args, **kwargs) -> None:
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleEligibilityScheduleInstance"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule instances of a role eligibility schedule.
:param scope: The scope of the role eligibility schedule. Required.
@@ -72,7 +75,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleInstance or the result of
cls(response)
:rtype:
@@ -87,7 +89,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,16 +100,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -118,14 +118,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("RoleEligibilityScheduleInstanceListResult", pipeline_response)
@@ -135,11 +134,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
@@ -151,8 +150,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"}
-
@distributed_trace_async
async def get(
self, scope: str, role_eligibility_schedule_instance_name: str, **kwargs: Any
@@ -164,12 +161,11 @@ async def get(
:param role_eligibility_schedule_instance_name: The name (hash of schedule name + time) of the
role eligibility schedule to get. Required.
:type role_eligibility_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -185,20 +181,18 @@ async def get(
)
cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_instance_name=role_eligibility_schedule_instance_name,
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
@@ -207,13 +201,9 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py
index ee9875766ca6..13ee4aa35b5c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedule_requests_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._role_eligibility_schedule_requests_operations import (
build_cancel_request,
build_create_request,
@@ -36,11 +34,15 @@
build_list_for_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]]
-class RoleEligibilityScheduleRequestsOperations:
+class RoleEligibilityScheduleRequestsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -70,6 +72,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -89,7 +92,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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -100,11 +102,12 @@ async def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -119,11 +122,10 @@ async def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -134,9 +136,10 @@ async def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -151,18 +154,15 @@ async def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest or
+ IO[bytes]
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,23 +187,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -212,16 +210,12 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -234,12 +228,11 @@ async def get(
:param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule
request to get. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -255,20 +248,18 @@ async def get(
)
cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
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
@@ -277,21 +268,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleEligibilityScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule requests for a scope.
:param scope: The scope of the role eligibility schedule requests. Required.
@@ -304,7 +292,6 @@ def list_for_scope(
created for the current user. Use $filter=asApprover() to return all role eligibility schedule
requests where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of
cls(response)
:rtype:
@@ -319,7 +306,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -330,16 +317,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -350,14 +335,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("RoleEligibilityScheduleRequestListResult", pipeline_response)
@@ -367,11 +351,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
@@ -383,12 +367,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"}
-
@distributed_trace_async
- async def cancel( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any
- ) -> None:
+ async def cancel(self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any) -> None:
"""Cancels a pending role eligibility schedule request.
:param scope: The scope of the role eligibility request to cancel. Required.
@@ -396,12 +376,11 @@ async def cancel( # pylint: disable=inconsistent-return-statements
:param role_eligibility_schedule_request_name: The name of the role eligibility request to
cancel. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -417,20 +396,18 @@ async def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -440,8 +417,4 @@ async def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_operations.py
index 5ff534c83217..f297f5b4d776 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_eligibility_schedules_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._role_eligibility_schedules_operations import build_get_request, build_list_for_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]]
@@ -65,12 +67,11 @@ async def get(
:param role_eligibility_schedule_name: The name (guid) of the role eligibility schedule to get.
Required.
:type role_eligibility_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilitySchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilitySchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,20 +87,18 @@ async def get(
)
cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_name=role_eligibility_schedule_name,
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
@@ -108,21 +107,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleEligibilitySchedule"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedules for a resource scope.
:param scope: The scope of the role eligibility schedules. Required.
@@ -134,7 +130,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilitySchedule or the result of
cls(response)
:rtype:
@@ -149,7 +144,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -160,16 +155,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -180,14 +173,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("RoleEligibilityScheduleListResult", pipeline_response)
@@ -197,11 +189,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
@@ -212,5 +204,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_operations.py
index da805b810844..faf8aa76b179 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policies_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._role_management_policies_operations import (
build_delete_request,
build_get_request,
@@ -36,6 +34,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]]
@@ -69,12 +71,11 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any)
:param role_management_policy_name: The name (guid) of the role management policy to get.
Required.
:type role_management_policy_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,20 +91,18 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any)
)
cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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
@@ -112,16 +111,12 @@ async def get(self, scope: str, role_management_policy_name: str, **kwargs: Any)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@overload
async def update(
@@ -145,7 +140,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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -156,7 +150,7 @@ async def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -169,11 +163,10 @@ async def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. 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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -184,7 +177,7 @@ async def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: Union[_models.RoleManagementPolicy, IO],
+ parameters: Union[_models.RoleManagementPolicy, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicy:
"""Update a role management policy.
@@ -195,18 +188,14 @@ async def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -231,23 +220,21 @@ async def update(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicy")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -256,21 +243,15 @@ async def update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_management_policy_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> None:
"""Delete a role management policy.
:param scope: The scope of the role management policy to upsert. Required.
@@ -278,12 +259,11 @@ async def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_name: The name (guid) of the role management policy to upsert.
Required.
:type role_management_policy_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,
@@ -299,20 +279,18 @@ async def delete( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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
@@ -322,19 +300,15 @@ async def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicy"]:
+ # pylint: disable=line-too-long
"""Gets role management policies for a resource scope.
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicy or the result of
cls(response)
:rtype:
@@ -349,7 +323,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
)
cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -360,15 +334,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -379,14 +351,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("RoleManagementPolicyListResult", pipeline_response)
@@ -396,11 +367,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
@@ -411,5 +382,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_operations.py
index 818a1455ed84..ce3c79fd7e81 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/aio/operations/_role_management_policy_assignments_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._role_management_policy_assignments_operations import (
build_create_request,
build_delete_request,
@@ -36,11 +34,15 @@
build_list_for_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]]
-class RoleManagementPolicyAssignmentsOperations:
+class RoleManagementPolicyAssignmentsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -71,12 +73,11 @@ async def get(
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to get. Required.
:type role_management_policy_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -92,20 +93,18 @@ async def get(
)
cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -114,16 +113,12 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@overload
async def create(
@@ -148,7 +143,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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -159,7 +153,7 @@ async def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -172,11 +166,10 @@ async def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. 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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -187,7 +180,7 @@ async def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: Union[_models.RoleManagementPolicyAssignment, IO],
+ parameters: Union[_models.RoleManagementPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicyAssignment:
"""Create a role management policy assignment.
@@ -198,18 +191,15 @@ async def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. Is either a
- RoleManagementPolicyAssignment type or a IO type. Required.
+ RoleManagementPolicyAssignment type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment or
+ IO[bytes]
:return: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -234,23 +224,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicyAssignment")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -259,21 +247,15 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_management_policy_assignment_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, scope: str, role_management_policy_assignment_name: str, **kwargs: Any) -> None:
"""Delete a role management policy assignment.
:param scope: The scope of the role management policy assignment to delete. Required.
@@ -281,12 +263,11 @@ async def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to delete. Required.
:type role_management_policy_assignment_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,
@@ -302,20 +283,18 @@ async def delete( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -325,19 +304,15 @@ async def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.RoleManagementPolicyAssignment"]:
+ # pylint: disable=line-too-long
"""Gets role management assignment policies for a resource scope.
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicyAssignment or the result of
cls(response)
:rtype:
@@ -352,7 +327,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
)
cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -363,15 +338,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Ro
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -382,14 +355,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("RoleManagementPolicyAssignmentListResult", pipeline_response)
@@ -399,11 +371,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
@@ -414,5 +386,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py
index 3dac2f0b2994..cf8cf3a1efe3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/__init__.py
@@ -5,85 +5,96 @@
# 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 ApprovalSettings
-from ._models_py3 import ApprovalStage
-from ._models_py3 import CloudErrorBody
-from ._models_py3 import EligibleChildResource
-from ._models_py3 import EligibleChildResourcesListResult
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import ExpandedProperties
-from ._models_py3 import ExpandedPropertiesPrincipal
-from ._models_py3 import ExpandedPropertiesRoleDefinition
-from ._models_py3 import ExpandedPropertiesScope
-from ._models_py3 import Permission
-from ._models_py3 import PolicyAssignmentProperties
-from ._models_py3 import PolicyAssignmentPropertiesPolicy
-from ._models_py3 import PolicyAssignmentPropertiesRoleDefinition
-from ._models_py3 import PolicyAssignmentPropertiesScope
-from ._models_py3 import PolicyProperties
-from ._models_py3 import PolicyPropertiesScope
-from ._models_py3 import Principal
-from ._models_py3 import RoleAssignment
-from ._models_py3 import RoleAssignmentCreateParameters
-from ._models_py3 import RoleAssignmentFilter
-from ._models_py3 import RoleAssignmentListResult
-from ._models_py3 import RoleAssignmentSchedule
-from ._models_py3 import RoleAssignmentScheduleFilter
-from ._models_py3 import RoleAssignmentScheduleInstance
-from ._models_py3 import RoleAssignmentScheduleInstanceFilter
-from ._models_py3 import RoleAssignmentScheduleInstanceListResult
-from ._models_py3 import RoleAssignmentScheduleListResult
-from ._models_py3 import RoleAssignmentScheduleRequest
-from ._models_py3 import RoleAssignmentScheduleRequestFilter
-from ._models_py3 import RoleAssignmentScheduleRequestListResult
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfo
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesTicketInfo
-from ._models_py3 import RoleEligibilitySchedule
-from ._models_py3 import RoleEligibilityScheduleFilter
-from ._models_py3 import RoleEligibilityScheduleInstance
-from ._models_py3 import RoleEligibilityScheduleInstanceFilter
-from ._models_py3 import RoleEligibilityScheduleInstanceListResult
-from ._models_py3 import RoleEligibilityScheduleListResult
-from ._models_py3 import RoleEligibilityScheduleRequest
-from ._models_py3 import RoleEligibilityScheduleRequestFilter
-from ._models_py3 import RoleEligibilityScheduleRequestListResult
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfo
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesTicketInfo
-from ._models_py3 import RoleManagementPolicy
-from ._models_py3 import RoleManagementPolicyApprovalRule
-from ._models_py3 import RoleManagementPolicyAssignment
-from ._models_py3 import RoleManagementPolicyAssignmentListResult
-from ._models_py3 import RoleManagementPolicyAuthenticationContextRule
-from ._models_py3 import RoleManagementPolicyEnablementRule
-from ._models_py3 import RoleManagementPolicyExpirationRule
-from ._models_py3 import RoleManagementPolicyListResult
-from ._models_py3 import RoleManagementPolicyNotificationRule
-from ._models_py3 import RoleManagementPolicyRule
-from ._models_py3 import RoleManagementPolicyRuleTarget
-from ._models_py3 import UserSet
-from ._models_py3 import ValidationResponse
-from ._models_py3 import ValidationResponseErrorInfo
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import ApprovalMode
-from ._authorization_management_client_enums import AssignmentType
-from ._authorization_management_client_enums import EnablementRules
-from ._authorization_management_client_enums import MemberType
-from ._authorization_management_client_enums import NotificationDeliveryMechanism
-from ._authorization_management_client_enums import NotificationLevel
-from ._authorization_management_client_enums import PrincipalType
-from ._authorization_management_client_enums import RecipientType
-from ._authorization_management_client_enums import RequestType
-from ._authorization_management_client_enums import RoleManagementPolicyRuleType
-from ._authorization_management_client_enums import Status
-from ._authorization_management_client_enums import Type
-from ._authorization_management_client_enums import UserType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ApprovalSettings,
+ ApprovalStage,
+ CloudErrorBody,
+ EligibleChildResource,
+ EligibleChildResourcesListResult,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ ExpandedProperties,
+ ExpandedPropertiesPrincipal,
+ ExpandedPropertiesRoleDefinition,
+ ExpandedPropertiesScope,
+ Permission,
+ PolicyAssignmentProperties,
+ PolicyAssignmentPropertiesPolicy,
+ PolicyAssignmentPropertiesRoleDefinition,
+ PolicyAssignmentPropertiesScope,
+ PolicyProperties,
+ PolicyPropertiesScope,
+ Principal,
+ RoleAssignment,
+ RoleAssignmentCreateParameters,
+ RoleAssignmentFilter,
+ RoleAssignmentListResult,
+ RoleAssignmentSchedule,
+ RoleAssignmentScheduleFilter,
+ RoleAssignmentScheduleInstance,
+ RoleAssignmentScheduleInstanceFilter,
+ RoleAssignmentScheduleInstanceListResult,
+ RoleAssignmentScheduleListResult,
+ RoleAssignmentScheduleRequest,
+ RoleAssignmentScheduleRequestFilter,
+ RoleAssignmentScheduleRequestListResult,
+ RoleAssignmentScheduleRequestPropertiesScheduleInfo,
+ RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration,
+ RoleAssignmentScheduleRequestPropertiesTicketInfo,
+ RoleEligibilitySchedule,
+ RoleEligibilityScheduleFilter,
+ RoleEligibilityScheduleInstance,
+ RoleEligibilityScheduleInstanceFilter,
+ RoleEligibilityScheduleInstanceListResult,
+ RoleEligibilityScheduleListResult,
+ RoleEligibilityScheduleRequest,
+ RoleEligibilityScheduleRequestFilter,
+ RoleEligibilityScheduleRequestListResult,
+ RoleEligibilityScheduleRequestPropertiesScheduleInfo,
+ RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration,
+ RoleEligibilityScheduleRequestPropertiesTicketInfo,
+ RoleManagementPolicy,
+ RoleManagementPolicyApprovalRule,
+ RoleManagementPolicyAssignment,
+ RoleManagementPolicyAssignmentListResult,
+ RoleManagementPolicyAuthenticationContextRule,
+ RoleManagementPolicyEnablementRule,
+ RoleManagementPolicyExpirationRule,
+ RoleManagementPolicyListResult,
+ RoleManagementPolicyNotificationRule,
+ RoleManagementPolicyRule,
+ RoleManagementPolicyRuleTarget,
+ UserSet,
+ ValidationResponse,
+ ValidationResponseErrorInfo,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ ApprovalMode,
+ AssignmentType,
+ EnablementRules,
+ MemberType,
+ NotificationDeliveryMechanism,
+ NotificationLevel,
+ PrincipalType,
+ RecipientType,
+ RequestType,
+ RoleManagementPolicyRuleType,
+ Status,
+ Type,
+ UserType,
+)
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__ = [
@@ -163,5 +174,5 @@
"Type",
"UserType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py
index f75709cee514..467a11b6a47f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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.
@@ -13,7 +13,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -825,7 +824,7 @@ def __init__(
self.email = email
-class RoleAssignment(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignment(_serialization.Model):
"""Role Assignments.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -950,12 +949,12 @@ def __init__(
self.delegated_managed_identity_resource_id = delegated_managed_identity_resource_id
-class RoleAssignmentCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentCreateParameters(_serialization.Model):
"""Role assignment create parameters.
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 scope: The role assignment scope.
:vartype scope: str
@@ -1114,7 +1113,7 @@ def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, **
self.next_link = None
-class RoleAssignmentSchedule(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentSchedule(_serialization.Model):
"""Role Assignment schedule.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1335,7 +1334,7 @@ def __init__(
self.status = status
-class RoleAssignmentScheduleInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentScheduleInstance(_serialization.Model):
"""Information about current or upcoming role assignment schedule instance.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1643,7 +1642,7 @@ def __init__(
self.next_link = next_link
-class RoleAssignmentScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentScheduleRequest(_serialization.Model):
"""Role Assignment schedule request.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1908,7 +1907,7 @@ def __init__(
self.next_link = next_link
-class RoleAssignmentScheduleRequestPropertiesScheduleInfo(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesScheduleInfo(_serialization.Model): # pylint: disable=name-too-long
"""Schedule info of the role assignment schedule.
:ivar start_date_time: Start DateTime of the role assignment schedule.
@@ -1935,14 +1934,16 @@ def __init__(
:paramtype start_date_time: ~datetime.datetime
:keyword expiration: Expiration of the role assignment schedule.
:paramtype expiration:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration
+ ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration # pylint: disable=line-too-long
"""
super().__init__(**kwargs)
self.start_date_time = start_date_time
self.expiration = expiration
-class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(
+ _serialization.Model
+): # pylint: disable=name-too-long
"""Expiration of the role assignment schedule.
:ivar type: Type of the role assignment schedule expiration. Known values are: "AfterDuration",
@@ -1983,7 +1984,7 @@ def __init__(
self.duration = duration
-class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model): # pylint: disable=name-too-long
"""Ticket Info of the role assignment.
:ivar ticket_number: Ticket number for the role assignment.
@@ -2011,7 +2012,7 @@ def __init__(
self.ticket_system = ticket_system
-class RoleEligibilitySchedule(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleEligibilitySchedule(_serialization.Model):
"""Role eligibility schedule.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2212,7 +2213,7 @@ def __init__(
self.status = status
-class RoleEligibilityScheduleInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleEligibilityScheduleInstance(_serialization.Model):
"""Information about current or upcoming role eligibility schedule instance.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2415,7 +2416,7 @@ def __init__(
self.role_eligibility_schedule_id = role_eligibility_schedule_id
-class RoleEligibilityScheduleInstanceListResult(_serialization.Model):
+class RoleEligibilityScheduleInstanceListResult(_serialization.Model): # pylint: disable=name-too-long
"""Role eligibility schedule instance list operation result.
:ivar value: Role eligibility schedule instance list.
@@ -2483,7 +2484,7 @@ def __init__(
self.next_link = next_link
-class RoleEligibilityScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleEligibilityScheduleRequest(_serialization.Model):
"""Role Eligibility schedule request.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2739,7 +2740,7 @@ def __init__(
self.next_link = next_link
-class RoleEligibilityScheduleRequestPropertiesScheduleInfo(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesScheduleInfo(_serialization.Model): # pylint: disable=name-too-long
"""Schedule info of the role eligibility schedule.
:ivar start_date_time: Start DateTime of the role eligibility schedule.
@@ -2766,14 +2767,16 @@ def __init__(
:paramtype start_date_time: ~datetime.datetime
:keyword expiration: Expiration of the role eligibility schedule.
:paramtype expiration:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration
+ ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration # pylint: disable=line-too-long
"""
super().__init__(**kwargs)
self.start_date_time = start_date_time
self.expiration = expiration
-class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(
+ _serialization.Model
+): # pylint: disable=name-too-long
"""Expiration of the role eligibility schedule.
:ivar type: Type of the role eligibility schedule expiration. Known values are:
@@ -2814,7 +2817,7 @@ def __init__(
self.duration = duration
-class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model): # pylint: disable=name-too-long
"""Ticket Info of the role eligibility.
:ivar ticket_number: Ticket number for the role eligibility.
@@ -2842,7 +2845,7 @@ def __init__(
self.ticket_system = ticket_system
-class RoleManagementPolicy(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleManagementPolicy(_serialization.Model):
"""Role management policy.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2947,7 +2950,7 @@ class RoleManagementPolicyRule(_serialization.Model):
RoleManagementPolicyEnablementRule, RoleManagementPolicyExpirationRule,
RoleManagementPolicyNotificationRule
- 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: The id of the rule.
:vartype id: str
@@ -3005,7 +3008,7 @@ def __init__(
class RoleManagementPolicyApprovalRule(RoleManagementPolicyRule):
"""The role management policy approval rule.
- 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: The id of the rule.
:vartype id: str
@@ -3157,10 +3160,10 @@ def __init__(
self.next_link = next_link
-class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule):
+class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule): # pylint: disable=name-too-long
"""The role management policy authentication context rule.
- 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: The id of the rule.
:vartype id: str
@@ -3220,7 +3223,7 @@ def __init__(
class RoleManagementPolicyEnablementRule(RoleManagementPolicyRule):
"""The role management policy rule.
- 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: The id of the rule.
:vartype id: str
@@ -3275,7 +3278,7 @@ def __init__(
class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule):
"""The role management policy expiration rule.
- 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: The id of the rule.
:vartype id: str
@@ -3368,7 +3371,7 @@ def __init__(
class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule):
"""The role management policy notification rule.
- 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: The id of the rule.
:vartype id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/__init__.py
index c2480d05193e..34d8eaf4c975 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_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 ._role_assignments_operations import RoleAssignmentsOperations
-from ._eligible_child_resources_operations import EligibleChildResourcesOperations
-from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations
-from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations
-from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations
-from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations
-from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations
-from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations
-from ._role_management_policies_operations import RoleManagementPoliciesOperations
-from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._eligible_child_resources_operations import EligibleChildResourcesOperations # type: ignore
+from ._role_assignment_schedules_operations import RoleAssignmentSchedulesOperations # type: ignore
+from ._role_assignment_schedule_instances_operations import RoleAssignmentScheduleInstancesOperations # type: ignore
+from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations # type: ignore
+from ._role_eligibility_schedules_operations import RoleEligibilitySchedulesOperations # type: ignore
+from ._role_eligibility_schedule_instances_operations import RoleEligibilityScheduleInstancesOperations # type: ignore
+from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations # type: ignore
+from ._role_management_policies_operations import RoleManagementPoliciesOperations # type: ignore
+from ._role_management_policy_assignments_operations import RoleManagementPolicyAssignmentsOperations # 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 @@
"RoleManagementPoliciesOperations",
"RoleManagementPolicyAssignmentsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py
index 0de809492db8..4c3088b5cadb 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_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, 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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -93,7 +95,6 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab
$filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource
of type = 'Subscription' or 'ResourceGroup'. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either EligibleChildResource or the result of
cls(response)
:rtype:
@@ -108,7 +109,7 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab
)
cls: ClsType[_models.EligibleChildResourcesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -119,16 +120,14 @@ def get(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterab
def prepare_request(next_link=None):
if not next_link:
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
filter=filter,
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)
else:
# make call to next link with the client's api-version
@@ -139,14 +138,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("EligibleChildResourcesListResult", pipeline_response)
@@ -156,11 +154,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
@@ -171,5 +169,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/eligibleChildResources"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py
index 4df4b3d9601e..76d3e84725c3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -81,7 +83,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, *
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -92,7 +94,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, *
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleAssignmentScheduleInstancesOperations:
+class RoleAssignmentScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -116,6 +118,7 @@ def __init__(self, *args, **kwargs):
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.RoleAssignmentScheduleInstance"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule instances of a role assignment schedule.
:param scope: The scope of the role assignment schedule. Required.
@@ -127,7 +130,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedule instances created for the current
user. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleInstance or the result of
cls(response)
:rtype:
@@ -142,7 +144,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -153,16 +155,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -173,14 +173,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("RoleAssignmentScheduleInstanceListResult", pipeline_response)
@@ -190,11 +189,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
@@ -206,8 +205,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances"}
-
@distributed_trace
def get(
self, scope: str, role_assignment_schedule_instance_name: str, **kwargs: Any
@@ -219,12 +216,11 @@ def get(
:param role_assignment_schedule_instance_name: The name (hash of schedule name + time) of the
role assignment schedule to get. Required.
:type role_assignment_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -240,20 +236,18 @@ def get(
)
cls: ClsType[_models.RoleAssignmentScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_instance_name=role_assignment_schedule_instance_name,
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
@@ -262,13 +256,9 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py
index a6c978ce2b2f..5b4357954b99 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_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, _format_url_section
+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]]
@@ -57,7 +59,7 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,7 +91,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, **
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,7 +115,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -145,7 +147,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -186,6 +188,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -205,7 +208,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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -216,11 +218,12 @@ def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -235,11 +238,10 @@ def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -250,9 +252,10 @@ def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -267,18 +270,14 @@ def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest or IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -303,23 +302,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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,16 +325,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -350,12 +343,11 @@ def get(
:param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule
request to get. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -371,20 +363,18 @@ def get(
)
cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
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
@@ -393,21 +383,18 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.RoleAssignmentScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule requests for a scope.
:param scope: The scope of the role assignments schedule requests. Required.
@@ -420,7 +407,6 @@ def list_for_scope(
for the current user. Use $filter=asApprover() to return all role assignment schedule requests
where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of
cls(response)
:rtype:
@@ -435,7 +421,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -446,16 +432,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -466,14 +450,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("RoleAssignmentScheduleRequestListResult", pipeline_response)
@@ -483,11 +466,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
@@ -499,8 +482,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"}
-
@distributed_trace
def cancel( # pylint: disable=inconsistent-return-statements
self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any
@@ -512,12 +493,11 @@ def cancel( # pylint: disable=inconsistent-return-statements
:param role_assignment_schedule_request_name: The name of the role assignment request to
cancel. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -533,20 +513,18 @@ def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -556,8 +534,4 @@ def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py
index d48d9d282408..16a87705f9b4 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs:
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -121,12 +123,11 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) ->
:param role_assignment_schedule_name: The name (guid) of the role assignment schedule to get.
Required.
:type role_assignment_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentSchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentSchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -142,20 +143,18 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) ->
)
cls: ClsType[_models.RoleAssignmentSchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_name=role_assignment_schedule_name,
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
@@ -164,16 +163,12 @@ def get(self, scope: str, role_assignment_schedule_name: str, **kwargs: Any) ->
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentSchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -190,7 +185,6 @@ def list_for_scope(
Use $filter=asTarget() to return all role assignment schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentSchedule or the result of
cls(response)
:rtype:
@@ -205,7 +199,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -216,16 +210,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -236,14 +228,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("RoleAssignmentScheduleListResult", pipeline_response)
@@ -253,11 +244,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
@@ -268,5 +259,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py
index 98836d3722c6..fe153fc1a3f0 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py
@@ -7,6 +7,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 +21,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, _format_url_section
+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]]
@@ -54,7 +57,7 @@ def build_list_for_subscription_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -95,7 +98,7 @@ def build_list_for_resource_group_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -144,7 +147,7 @@ def build_list_for_resource_request(
"resourceName": _SERIALIZER.url("resource_name", resource_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -175,7 +178,7 @@ def build_get_request(
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -203,7 +206,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -232,7 +235,7 @@ def build_delete_request(
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -262,7 +265,7 @@ def build_validate_request(scope: str, role_assignment_name: str, **kwargs: Any)
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -290,7 +293,7 @@ def build_list_for_scope_request(
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -318,7 +321,7 @@ def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str]
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -345,7 +348,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -373,7 +376,7 @@ def build_delete_by_id_request(
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -400,7 +403,7 @@ def build_validate_by_id_request(role_assignment_id: str, **kwargs: Any) -> Http
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -445,7 +448,6 @@ def list_for_subscription(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -459,7 +461,7 @@ def list_for_subscription(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -470,17 +472,15 @@ def list_for_subscription(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_subscription_request(
+ _request = build_list_for_subscription_request(
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_subscription.metadata["url"],
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
@@ -491,14 +491,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("RoleAssignmentListResult", pipeline_response)
@@ -508,11 +507,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
@@ -525,10 +524,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_subscription.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -544,7 +539,6 @@ def list_for_resource_group(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -558,7 +552,7 @@ def list_for_resource_group(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -569,18 +563,16 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -591,14 +583,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("RoleAssignmentListResult", pipeline_response)
@@ -608,11 +599,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
@@ -625,10 +616,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -658,7 +645,6 @@ def list_for_resource(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -672,7 +658,7 @@ def list_for_resource(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -683,7 +669,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
resource_type=resource_type,
@@ -692,12 +678,10 @@ def prepare_request(next_link=None):
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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 +692,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("RoleAssignmentListResult", pipeline_response)
@@ -725,11 +708,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
@@ -742,14 +725,11 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def get(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Get a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -763,12 +743,11 @@ def get(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -784,21 +763,19 @@ def get(
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -808,14 +785,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
def create(
@@ -827,6 +802,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -844,7 +820,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -855,11 +830,12 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -872,11 +848,10 @@ def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -887,9 +862,10 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -902,18 +878,15 @@ def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -938,23 +911,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -964,23 +935,18 @@ def create(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
-
@distributed_trace
def delete(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> Optional[_models.RoleAssignment]:
+ # pylint: disable=line-too-long
"""Delete a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -994,12 +960,11 @@ def delete(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1015,21 +980,19 @@ def delete(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -1041,14 +1004,12 @@ def delete(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
def validate(
@@ -1060,6 +1021,7 @@ def validate(
content_type: str = "application/json",
**kwargs: Any
) -> _models.ValidationResponse:
+ # pylint: disable=line-too-long
"""Validate a role assignment create or update operation by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -1077,7 +1039,6 @@ def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1088,11 +1049,12 @@ def validate(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ValidationResponse:
+ # pylint: disable=line-too-long
"""Validate a role assignment create or update operation by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -1105,11 +1067,10 @@ def validate(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1120,9 +1081,10 @@ def validate(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.ValidationResponse:
+ # pylint: disable=line-too-long
"""Validate a role assignment create or update operation by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -1135,18 +1097,15 @@ def validate(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1171,23 +1130,21 @@ def validate(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -1197,21 +1154,18 @@ def validate(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ValidationResponse", pipeline_response)
+ deserialized = self._deserialize("ValidationResponse", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.RoleAssignment"]:
+ # pylint: disable=line-too-long
"""List all role assignments that apply to a scope.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -1226,7 +1180,6 @@ def list_for_scope(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment]
@@ -1240,7 +1193,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1251,17 +1204,15 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -1272,14 +1223,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("RoleAssignmentListResult", pipeline_response)
@@ -1289,11 +1239,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
@@ -1306,8 +1256,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def get_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -1317,17 +1265,17 @@ def get_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1343,20 +1291,18 @@ def get_by_id(
)
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -1366,14 +1312,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
def create_by_id(
@@ -1389,8 +1333,9 @@ def create_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Required.
:type parameters:
@@ -1398,7 +1343,6 @@ def create_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1406,22 +1350,22 @@ def create_by_id(
@overload
def create_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1429,29 +1373,30 @@ def create_by_id(
@distributed_trace
def create_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1476,22 +1421,20 @@ def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -1501,19 +1444,13 @@ def create_by_id(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_by_id.metadata = {"url": "/{roleAssignmentId}"}
-
@distributed_trace
def delete_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -1523,17 +1460,17 @@ def delete_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1549,20 +1486,18 @@ def delete_by_id(
)
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -1574,14 +1509,12 @@ def delete_by_id(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
def validate_by_id(
@@ -1597,8 +1530,9 @@ def validate_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Required.
:type parameters:
@@ -1606,7 +1540,6 @@ def validate_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1614,22 +1547,22 @@ def validate_by_id(
@overload
def validate_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.ValidationResponse:
"""Validate a role assignment create or update operation by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1637,29 +1570,30 @@ def validate_by_id(
@distributed_trace
def validate_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.ValidationResponse:
"""Validate a role assignment create or update operation by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleAssignmentCreateParameters or
+ IO[bytes]
:return: ValidationResponse or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.ValidationResponse
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1684,22 +1618,20 @@ def validate_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_validate_by_id_request(
+ _request = build_validate_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate_by_id.metadata["url"],
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
@@ -1709,11 +1641,9 @@ def validate_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ValidationResponse", pipeline_response)
+ deserialized = self._deserialize("ValidationResponse", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate_by_id.metadata = {"url": "/{roleAssignmentId}/validate"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py
index 462d376f9d30..b9e832000cf3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -81,7 +83,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -92,7 +94,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str,
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleEligibilityScheduleInstancesOperations:
+class RoleEligibilityScheduleInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -116,6 +118,7 @@ def __init__(self, *args, **kwargs):
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.RoleEligibilityScheduleInstance"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule instances of a role eligibility schedule.
:param scope: The scope of the role eligibility schedule. Required.
@@ -127,7 +130,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleInstance or the result of
cls(response)
:rtype:
@@ -142,7 +144,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -153,16 +155,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -173,14 +173,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("RoleEligibilityScheduleInstanceListResult", pipeline_response)
@@ -190,11 +189,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
@@ -206,8 +205,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances"}
-
@distributed_trace
def get(
self, scope: str, role_eligibility_schedule_instance_name: str, **kwargs: Any
@@ -219,12 +216,11 @@ def get(
:param role_eligibility_schedule_instance_name: The name (hash of schedule name + time) of the
role eligibility schedule to get. Required.
:type role_eligibility_schedule_instance_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -240,20 +236,18 @@ def get(
)
cls: ClsType[_models.RoleEligibilityScheduleInstance] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_instance_name=role_eligibility_schedule_instance_name,
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
@@ -262,13 +256,9 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py
index 179ab436ba63..98a5931cddea 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_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, _format_url_section
+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]]
@@ -57,7 +59,7 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,7 +91,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, *
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,7 +115,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -145,7 +147,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -156,7 +158,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleEligibilityScheduleRequestsOperations:
+class RoleEligibilityScheduleRequestsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -186,6 +188,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -205,7 +208,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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -216,11 +218,12 @@ def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -235,11 +238,10 @@ def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -250,9 +252,10 @@ def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -267,18 +270,15 @@ def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest or
+ IO[bytes]
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -303,23 +303,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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,16 +326,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -350,12 +344,11 @@ def get(
:param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule
request to get. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -371,20 +364,18 @@ def get(
)
cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
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
@@ -393,21 +384,18 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.RoleEligibilityScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule requests for a scope.
:param scope: The scope of the role eligibility schedule requests. Required.
@@ -420,7 +408,6 @@ def list_for_scope(
created for the current user. Use $filter=asApprover() to return all role eligibility schedule
requests where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of
cls(response)
:rtype:
@@ -435,7 +422,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -446,16 +433,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -466,14 +451,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("RoleEligibilityScheduleRequestListResult", pipeline_response)
@@ -483,11 +467,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
@@ -499,8 +483,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"}
-
@distributed_trace
def cancel( # pylint: disable=inconsistent-return-statements
self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any
@@ -512,12 +494,11 @@ def cancel( # pylint: disable=inconsistent-return-statements
:param role_eligibility_schedule_request_name: The name of the role eligibility request to
cancel. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -533,20 +514,18 @@ def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -556,8 +535,4 @@ def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py
index f7b2e7ba2fa6..01bf68c15c84 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs:
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -121,12 +123,11 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) ->
:param role_eligibility_schedule_name: The name (guid) of the role eligibility schedule to get.
Required.
:type role_eligibility_schedule_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilitySchedule or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleEligibilitySchedule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -142,20 +143,18 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) ->
)
cls: ClsType[_models.RoleEligibilitySchedule] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_name=role_eligibility_schedule_name,
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
@@ -164,16 +163,12 @@ def get(self, scope: str, role_eligibility_schedule_name: str, **kwargs: Any) ->
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilitySchedule", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -190,7 +185,6 @@ def list_for_scope(
$filter=asTarget() to return all role eligibility schedules created for the current user.
Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilitySchedule or the result of
cls(response)
:rtype:
@@ -205,7 +199,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -216,16 +210,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -236,14 +228,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("RoleEligibilityScheduleListResult", pipeline_response)
@@ -253,11 +244,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
@@ -268,5 +259,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py
index 95f8a85ac085..904de9129d89 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An
"roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +83,7 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs:
"roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -110,7 +112,7 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs:
"roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -134,7 +136,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -174,12 +176,11 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m
:param role_management_policy_name: The name (guid) of the role management policy to get.
Required.
:type role_management_policy_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -195,20 +196,18 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m
)
cls: ClsType[_models.RoleManagementPolicy] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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
@@ -217,16 +216,12 @@ def get(self, scope: str, role_management_policy_name: str, **kwargs: Any) -> _m
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@overload
def update(
@@ -250,7 +245,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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -261,7 +255,7 @@ def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -274,11 +268,10 @@ def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. 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: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
@@ -289,7 +282,7 @@ def update(
self,
scope: str,
role_management_policy_name: str,
- parameters: Union[_models.RoleManagementPolicy, IO],
+ parameters: Union[_models.RoleManagementPolicy, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicy:
"""Update a role management policy.
@@ -300,18 +293,14 @@ def update(
Required.
:type role_management_policy_name: str
:param parameters: Parameters for the role management policy. Is either a RoleManagementPolicy
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleManagementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -336,23 +325,21 @@ def update(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicy")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -361,16 +348,12 @@ def update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicy", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicy", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- update.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
@@ -383,12 +366,11 @@ def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_name: The name (guid) of the role management policy to upsert.
Required.
:type role_management_policy_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,
@@ -404,20 +386,18 @@ def delete( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_name=role_management_policy_name,
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
@@ -427,11 +407,7 @@ def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicy"]:
@@ -439,7 +415,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicy or the result of
cls(response)
:rtype:
@@ -454,7 +429,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
)
cls: ClsType[_models.RoleManagementPolicyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -465,15 +440,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -484,14 +457,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("RoleManagementPolicyListResult", pipeline_response)
@@ -501,11 +473,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
@@ -516,5 +488,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py
index 2a9a210e7a20..a3915fcb051c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, *
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -119,7 +121,7 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -143,7 +145,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -154,7 +156,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleManagementPolicyAssignmentsOperations:
+class RoleManagementPolicyAssignmentsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -185,12 +187,11 @@ def get(
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to get. Required.
:type role_management_policy_assignment_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -206,20 +207,18 @@ def get(
)
cls: ClsType[_models.RoleManagementPolicyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -228,16 +227,12 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@overload
def create(
@@ -262,7 +257,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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -273,7 +267,7 @@ def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -286,11 +280,10 @@ def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. 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: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -301,7 +294,7 @@ def create(
self,
scope: str,
role_management_policy_assignment_name: str,
- parameters: Union[_models.RoleManagementPolicyAssignment, IO],
+ parameters: Union[_models.RoleManagementPolicyAssignment, IO[bytes]],
**kwargs: Any
) -> _models.RoleManagementPolicyAssignment:
"""Create a role management policy assignment.
@@ -312,18 +305,15 @@ def create(
management policy assignment to upsert. Required.
:type role_management_policy_assignment_name: str
:param parameters: Parameters for the role management policy assignment. Is either a
- RoleManagementPolicyAssignment type or a IO type. Required.
+ RoleManagementPolicyAssignment type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment or
+ IO[bytes]
:return: RoleManagementPolicyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2020_10_01_preview.models.RoleManagementPolicyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -348,23 +338,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleManagementPolicyAssignment")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -373,16 +361,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleManagementPolicyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
@@ -395,12 +379,11 @@ def delete( # pylint: disable=inconsistent-return-statements
:param role_management_policy_assignment_name: The name of format {guid_guid} the role
management policy assignment to delete. Required.
:type role_management_policy_assignment_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,
@@ -416,20 +399,18 @@ def delete( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_management_policy_assignment_name=role_management_policy_assignment_name,
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
@@ -439,19 +420,15 @@ def delete( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleManagementPolicyAssignment"]:
+ # pylint: disable=line-too-long
"""Gets role management assignment policies for a resource scope.
:param scope: The scope of the role management policy. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleManagementPolicyAssignment or the result of
cls(response)
:rtype:
@@ -466,7 +443,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
)
cls: ClsType[_models.RoleManagementPolicyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -477,15 +454,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.RoleMan
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -496,14 +471,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("RoleManagementPolicyAssignmentListResult", pipeline_response)
@@ -513,11 +487,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
@@ -528,5 +502,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py
index 6fe9e6b5e358..1db813d7eb38 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_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
@@ -26,11 +29,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Request Approvals service provides the workflow for running request approvals on different kind
of resources.
@@ -68,7 +70,25 @@ def __init__(
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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)
@@ -96,7 +116,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-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
@@ -116,12 +136,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py
index 6dd3f3d72079..9ef1c8c83cf3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-01-01-preview")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_metadata.json
index c964b3aa4069..468359116e82 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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": 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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -88,8 +88,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": {
"operations": "Operations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_client.py
index 26d5b0b18a30..bf541047a191 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_authorization_management_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
@@ -26,11 +29,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Request Approvals service provides the workflow for running request approvals on different kind
of resources.
@@ -68,7 +70,25 @@ def __init__(
self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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)
@@ -96,7 +116,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-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
@@ -116,12 +138,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_configuration.py
index d9c6a3b71eb0..0f6b48753fdc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-01-01-preview")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/__init__.py
index 1349e3f13a6f..08d1d0a388d9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_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 ._operations import Operations
-from ._role_assignment_approval_operations import RoleAssignmentApprovalOperations
-from ._role_assignment_approval_steps_operations import RoleAssignmentApprovalStepsOperations
-from ._role_assignment_approval_step_operations import RoleAssignmentApprovalStepOperations
-from ._scope_role_assignment_approval_operations import ScopeRoleAssignmentApprovalOperations
-from ._scope_role_assignment_approval_steps_operations import ScopeRoleAssignmentApprovalStepsOperations
-from ._scope_role_assignment_approval_step_operations import ScopeRoleAssignmentApprovalStepOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._role_assignment_approval_operations import RoleAssignmentApprovalOperations # type: ignore
+from ._role_assignment_approval_steps_operations import RoleAssignmentApprovalStepsOperations # type: ignore
+from ._role_assignment_approval_step_operations import RoleAssignmentApprovalStepOperations # type: ignore
+from ._scope_role_assignment_approval_operations import ScopeRoleAssignmentApprovalOperations # type: ignore
+from ._scope_role_assignment_approval_steps_operations import ScopeRoleAssignmentApprovalStepsOperations # type: ignore
+from ._scope_role_assignment_approval_step_operations import ScopeRoleAssignmentApprovalStepOperations # 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__ = [
@@ -27,5 +33,5 @@
"ScopeRoleAssignmentApprovalStepsOperations",
"ScopeRoleAssignmentApprovalStepOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_operations.py
index 21203e527e40..911e5bd6ef7d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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]]
@@ -57,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2021_01_01_preview.models.Operation]
@@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -82,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
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 +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("OperationListResult", pipeline_response)
@@ -117,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
@@ -133,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_operations.py
index ef6aede4d8f1..950babfa1a0c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_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._role_assignment_approval_operations import build_get_by_id_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]]
@@ -56,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleAssignmentApproval"]:
+ # pylint: disable=line-too-long
"""Get role assignment approvals.
:param filter: The filter to apply on the operation. Valid values for $filter are:
@@ -67,7 +70,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
returned list only includes all role assignment approvals that the calling user has requests
targeted for. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentApproval or the result of
cls(response)
:rtype:
@@ -82,7 +84,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
)
cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -93,15 +95,13 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -112,14 +112,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("RoleAssignmentApprovalListResult", pipeline_response)
@@ -129,11 +128,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
@@ -146,20 +145,17 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals"}
-
@distributed_trace_async
async def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApproval:
"""Get role assignment approval.
:param approval_id: The id of the role assignment approval. Required.
:type approval_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApproval or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -175,19 +171,17 @@ async def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssign
)
cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -197,11 +191,9 @@ async def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssign
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_operations.py
index 911e15f5a852..aa5684b8a1ed 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_step_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,20 +18,22 @@
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._role_assignment_approval_step_operations import (
build_get_by_id_request,
build_patch_request,
build_put_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]]
@@ -64,12 +66,11 @@ async def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _mo
:type approval_id: str
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,20 +86,18 @@ async def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _mo
)
cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
stage_id=stage_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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 get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _mo
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
@overload
async def patch(
@@ -141,7 +136,6 @@ async def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -149,7 +143,13 @@ async def patch(
@overload
async def patch(
- self, approval_id: str, stage_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ approval_id: str,
+ stage_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -158,11 +158,10 @@ async def patch(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to patch. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -173,7 +172,7 @@ async def patch(
self,
approval_id: str,
stage_id: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -183,18 +182,15 @@ async def patch(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to patch. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -219,23 +215,21 @@ async def patch(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_patch_request(
+ _request = build_patch_request(
approval_id=approval_id,
stage_id=stage_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -245,14 +239,12 @@ async def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"}
+ return deserialized # type: ignore
@overload
async def put(
@@ -276,7 +268,6 @@ async def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -284,7 +275,13 @@ async def put(
@overload
async def put(
- self, approval_id: str, stage_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ approval_id: str,
+ stage_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -293,11 +290,10 @@ async def put(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to put. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -308,7 +304,7 @@ async def put(
self,
approval_id: str,
stage_id: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -318,18 +314,15 @@ async def put(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to put. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -354,23 +347,21 @@ async def put(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_put_request(
+ _request = build_put_request(
approval_id=approval_id,
stage_id=stage_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -380,11 +371,9 @@ async def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_operations.py
index 9ddcbca25087..99a18f2943c6 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_role_assignment_approval_steps_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._role_assignment_approval_steps_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,12 @@ async def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentA
:param approval_id: The id of the role assignment approval. Required.
:type approval_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStepListResult or the result of cls(response)
:rtype:
~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -79,19 +80,17 @@ async def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentA
)
cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None)
- request = build_list_request(
+ _request = build_list_request(
approval_id=approval_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)
_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
@@ -101,11 +100,9 @@ async def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentA
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_operations.py
index 06e5aeb7e332..2f6975f3610e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_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._scope_role_assignment_approval_operations import build_get_by_id_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]]
@@ -58,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignmentApproval"]:
+ # pylint: disable=line-too-long
"""Get role assignment approvals.
:param scope: The scope of the resource. Required.
@@ -71,7 +74,6 @@ def list(
returned list only includes all role assignment approvals that the calling user has requests
targeted for. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentApproval or the result of
cls(response)
:rtype:
@@ -86,7 +88,7 @@ def list(
)
cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -97,16 +99,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -117,14 +117,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("RoleAssignmentApprovalListResult", pipeline_response)
@@ -134,11 +133,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
@@ -151,8 +150,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals"}
-
@distributed_trace_async
async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssignmentApproval:
"""Get role assignment approval.
@@ -161,12 +158,11 @@ async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _model
:type approval_id: str
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApproval or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -182,20 +178,18 @@ async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _model
)
cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
scope=scope,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -205,11 +199,9 @@ async def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _model
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_operations.py
index c45868f6f320..c8346e117c15 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_step_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,25 +18,27 @@
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._scope_role_assignment_approval_step_operations import (
build_get_by_id_request,
build_patch_request,
build_put_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 ScopeRoleAssignmentApprovalStepOperations:
+class ScopeRoleAssignmentApprovalStepOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -68,12 +70,11 @@ async def get_by_id(
:type stage_id: str
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,21 +90,19 @@ async def get_by_id(
)
cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
stage_id=stage_id,
scope=scope,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -113,16 +112,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
@overload
async def patch(
@@ -149,7 +144,6 @@ async def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -161,7 +155,7 @@ async def patch(
approval_id: str,
stage_id: str,
scope: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -175,11 +169,10 @@ async def patch(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to patch. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -191,7 +184,7 @@ async def patch(
approval_id: str,
stage_id: str,
scope: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -203,18 +196,15 @@ async def patch(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to patch. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -239,7 +229,7 @@ async def patch(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_patch_request(
+ _request = build_patch_request(
approval_id=approval_id,
stage_id=stage_id,
scope=scope,
@@ -247,16 +237,14 @@ async def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -266,16 +254,12 @@ async def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
@overload
async def put(
@@ -302,7 +286,6 @@ async def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -314,7 +297,7 @@ async def put(
approval_id: str,
stage_id: str,
scope: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -328,11 +311,10 @@ async def put(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to put. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -344,7 +326,7 @@ async def put(
approval_id: str,
stage_id: str,
scope: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -356,18 +338,15 @@ async def put(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to put. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -392,7 +371,7 @@ async def put(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_put_request(
+ _request = build_put_request(
approval_id=approval_id,
stage_id=stage_id,
scope=scope,
@@ -400,16 +379,14 @@ async def put(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -419,13 +396,9 @@ async def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_operations.py
index bcf5c7229157..f078827aedea 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/aio/operations/_scope_role_assignment_approval_steps_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,21 +17,23 @@
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._scope_role_assignment_approval_steps_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]]
-class ScopeRoleAssignmentApprovalStepsOperations:
+class ScopeRoleAssignmentApprovalStepsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -59,13 +61,12 @@ async def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Rol
:type approval_id: str
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStepListResult or the result of cls(response)
:rtype:
~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -81,20 +82,18 @@ async def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Rol
)
cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None)
- request = build_list_request(
+ _request = build_list_request(
approval_id=approval_id,
scope=scope,
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)
_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
@@ -104,11 +103,9 @@ async def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Rol
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py
index 939a734a9b72..013a37579bbc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py
@@ -5,23 +5,34 @@
# 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 ErrorDefinition
-from ._models_py3 import ErrorDefinitionProperties
-from ._models_py3 import Operation
-from ._models_py3 import OperationDisplay
-from ._models_py3 import OperationListResult
-from ._models_py3 import RoleAssignmentApproval
-from ._models_py3 import RoleAssignmentApprovalListResult
-from ._models_py3 import RoleAssignmentApprovalStep
-from ._models_py3 import RoleAssignmentApprovalStepListResult
-from ._models_py3 import RoleAssignmentApprovalStepProperties
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import RoleAssignmentApprovalActorIdentityType
-from ._authorization_management_client_enums import RoleAssignmentApprovalStepReviewResult
-from ._authorization_management_client_enums import RoleAssignmentApprovalStepStatus
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ErrorDefinition,
+ ErrorDefinitionProperties,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ RoleAssignmentApproval,
+ RoleAssignmentApprovalListResult,
+ RoleAssignmentApprovalStep,
+ RoleAssignmentApprovalStepListResult,
+ RoleAssignmentApprovalStepProperties,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ RoleAssignmentApprovalActorIdentityType,
+ RoleAssignmentApprovalStepReviewResult,
+ RoleAssignmentApprovalStepStatus,
+)
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__ = [
@@ -39,5 +50,5 @@
"RoleAssignmentApprovalStepReviewResult",
"RoleAssignmentApprovalStepStatus",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py
index ee0554ffecee..2b7a0f74c6fa 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_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.
@@ -12,7 +11,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -253,7 +251,7 @@ def __init__(self, *, value: Optional[List["_models.RoleAssignmentApproval"]] =
self.next_link = None
-class RoleAssignmentApprovalStep(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentApprovalStep(_serialization.Model):
"""Role assignment approval stage properties.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py
index 1349e3f13a6f..08d1d0a388d9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_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 ._operations import Operations
-from ._role_assignment_approval_operations import RoleAssignmentApprovalOperations
-from ._role_assignment_approval_steps_operations import RoleAssignmentApprovalStepsOperations
-from ._role_assignment_approval_step_operations import RoleAssignmentApprovalStepOperations
-from ._scope_role_assignment_approval_operations import ScopeRoleAssignmentApprovalOperations
-from ._scope_role_assignment_approval_steps_operations import ScopeRoleAssignmentApprovalStepsOperations
-from ._scope_role_assignment_approval_step_operations import ScopeRoleAssignmentApprovalStepOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._role_assignment_approval_operations import RoleAssignmentApprovalOperations # type: ignore
+from ._role_assignment_approval_steps_operations import RoleAssignmentApprovalStepsOperations # type: ignore
+from ._role_assignment_approval_step_operations import RoleAssignmentApprovalStepOperations # type: ignore
+from ._scope_role_assignment_approval_operations import ScopeRoleAssignmentApprovalOperations # type: ignore
+from ._scope_role_assignment_approval_steps_operations import ScopeRoleAssignmentApprovalStepsOperations # type: ignore
+from ._scope_role_assignment_approval_step_operations import ScopeRoleAssignmentApprovalStepOperations # 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__ = [
@@ -27,5 +33,5 @@
"ScopeRoleAssignmentApprovalStepsOperations",
"ScopeRoleAssignmentApprovalStepOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py
index 548e4758bdcc..b80220c20d3a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2021_01_01_preview.models.Operation]
@@ -93,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = 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.Operation"]:
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("OperationListResult", 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.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py
index 44572006418a..42a3b438d001 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_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, _format_url_section
+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]]
@@ -70,7 +72,7 @@ def build_get_by_id_request(approval_id: str, **kwargs: Any) -> HttpRequest:
"approvalId": _SERIALIZER.url("approval_id", approval_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -114,7 +116,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
returned list only includes all role assignment approvals that the calling user has requests
targeted for. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentApproval or the result of
cls(response)
:rtype:
@@ -129,7 +130,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -140,15 +141,13 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -159,14 +158,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("RoleAssignmentApprovalListResult", pipeline_response)
@@ -176,11 +174,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
@@ -193,20 +191,17 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals"}
-
@distributed_trace
def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApproval:
"""Get role assignment approval.
:param approval_id: The id of the role assignment approval. Required.
:type approval_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApproval or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -222,19 +217,17 @@ def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentAp
)
cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -244,11 +237,9 @@ def get_by_id(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentAp
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py
index 4e87856a8042..9ea9f9bfcad4 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_get_by_id_request(approval_id: str, stage_id: str, **kwargs: Any) -> H
"stageId": _SERIALIZER.url("stage_id", stage_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_patch_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpR
"stageId": _SERIALIZER.url("stage_id", stage_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -109,7 +111,7 @@ def build_put_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpReq
"stageId": _SERIALIZER.url("stage_id", stage_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -150,12 +152,11 @@ def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _models.R
:type approval_id: str
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -171,20 +172,18 @@ def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _models.R
)
cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
stage_id=stage_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -194,16 +193,12 @@ def get_by_id(self, approval_id: str, stage_id: str, **kwargs: Any) -> _models.R
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
@overload
def patch(
@@ -227,7 +222,6 @@ def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -235,7 +229,13 @@ def patch(
@overload
def patch(
- self, approval_id: str, stage_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ approval_id: str,
+ stage_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -244,11 +244,10 @@ def patch(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to patch. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -259,7 +258,7 @@ def patch(
self,
approval_id: str,
stage_id: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -269,18 +268,15 @@ def patch(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to patch. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -305,23 +301,21 @@ def patch(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_patch_request(
+ _request = build_patch_request(
approval_id=approval_id,
stage_id=stage_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -331,14 +325,12 @@ def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- patch.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"}
+ return deserialized # type: ignore
@overload
def put(
@@ -362,7 +354,6 @@ def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -370,7 +361,13 @@ def put(
@overload
def put(
- self, approval_id: str, stage_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ approval_id: str,
+ stage_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -379,11 +376,10 @@ def put(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to put. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -394,7 +390,7 @@ def put(
self,
approval_id: str,
stage_id: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -404,18 +400,15 @@ def put(
:param stage_id: The id of the role assignment approval stage. Required.
:type stage_id: str
:param properties: Role Assignment Approval stage properties to put. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -440,23 +433,21 @@ def put(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_put_request(
+ _request = build_put_request(
approval_id=approval_id,
stage_id=stage_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -466,11 +457,9 @@ def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py
index 212d0864a22d..a0cbea3b9651 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_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, _format_url_section
+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]]
@@ -47,7 +49,7 @@ def build_list_request(approval_id: str, **kwargs: Any) -> HttpRequest:
"approvalId": _SERIALIZER.url("approval_id", approval_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -84,13 +86,12 @@ def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApprova
:param approval_id: The id of the role assignment approval. Required.
:type approval_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStepListResult or the result of cls(response)
:rtype:
~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,19 +107,17 @@ def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApprova
)
cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None)
- request = build_list_request(
+ _request = build_list_request(
approval_id=approval_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)
_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
@@ -128,11 +127,9 @@ def list(self, approval_id: str, **kwargs: Any) -> _models.RoleAssignmentApprova
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py
index 9fba479aa086..3aa1b026c129 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,7 +78,7 @@ def build_get_by_id_request(approval_id: str, scope: str, **kwargs: Any) -> Http
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -124,7 +126,6 @@ def list(
returned list only includes all role assignment approvals that the calling user has requests
targeted for. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentApproval or the result of
cls(response)
:rtype:
@@ -139,7 +140,7 @@ def list(
)
cls: ClsType[_models.RoleAssignmentApprovalListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -150,16 +151,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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("RoleAssignmentApprovalListResult", 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
@@ -204,8 +202,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals"}
-
@distributed_trace
def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssignmentApproval:
"""Get role assignment approval.
@@ -214,12 +210,11 @@ def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Role
:type approval_id: str
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApproval or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -235,20 +230,18 @@ def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Role
)
cls: ClsType[_models.RoleAssignmentApproval] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
scope=scope,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -258,11 +251,9 @@ def get_by_id(self, approval_id: str, scope: str, **kwargs: Any) -> _models.Role
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApproval", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py
index 6b602185504e..0f19310e12d8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_get_by_id_request(approval_id: str, stage_id: str, scope: str, **kwarg
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_patch_request(approval_id: str, stage_id: str, scope: str, **kwargs: A
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -115,7 +117,7 @@ def build_put_request(approval_id: str, stage_id: str, scope: str, **kwargs: Any
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -128,7 +130,7 @@ def build_put_request(approval_id: str, stage_id: str, scope: str, **kwargs: Any
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeRoleAssignmentApprovalStepOperations:
+class ScopeRoleAssignmentApprovalStepOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -160,12 +162,11 @@ def get_by_id(
:type stage_id: str
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,21 +182,19 @@ def get_by_id(
)
cls: ClsType[_models.RoleAssignmentApprovalStep] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
approval_id=approval_id,
stage_id=stage_id,
scope=scope,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -205,16 +204,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
@overload
def patch(
@@ -241,7 +236,6 @@ def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -253,7 +247,7 @@ def patch(
approval_id: str,
stage_id: str,
scope: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -267,11 +261,10 @@ def patch(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to patch. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -283,7 +276,7 @@ def patch(
approval_id: str,
stage_id: str,
scope: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -295,18 +288,15 @@ def patch(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to patch. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -331,7 +321,7 @@ def patch(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_patch_request(
+ _request = build_patch_request(
approval_id=approval_id,
stage_id=stage_id,
scope=scope,
@@ -339,16 +329,14 @@ def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -358,16 +346,12 @@ def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
@overload
def put(
@@ -394,7 +378,6 @@ def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -406,7 +389,7 @@ def put(
approval_id: str,
stage_id: str,
scope: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -420,11 +403,10 @@ def put(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to put. 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
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
@@ -436,7 +418,7 @@ def put(
approval_id: str,
stage_id: str,
scope: str,
- properties: Union[_models.RoleAssignmentApprovalStepProperties, IO],
+ properties: Union[_models.RoleAssignmentApprovalStepProperties, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentApprovalStep:
"""Record a decision.
@@ -448,18 +430,15 @@ def put(
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Role Assignment Approval stage properties to put. Is either a
- RoleAssignmentApprovalStepProperties type or a IO type. Required.
+ RoleAssignmentApprovalStepProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties or
+ IO[bytes]
:return: RoleAssignmentApprovalStep or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -484,7 +463,7 @@ def put(
else:
_json = self._serialize.body(properties, "RoleAssignmentApprovalStepProperties")
- request = build_put_request(
+ _request = build_put_request(
approval_id=approval_id,
stage_id=stage_id,
scope=scope,
@@ -492,16 +471,14 @@ def put(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -511,13 +488,9 @@ def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStep", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- put.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py
index 9300cb8ffd34..21a9bd0787ea 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_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, _format_url_section
+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]]
@@ -50,7 +52,7 @@ def build_list_request(approval_id: str, scope: str, **kwargs: Any) -> HttpReque
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -61,7 +63,7 @@ def build_list_request(approval_id: str, scope: str, **kwargs: Any) -> HttpReque
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeRoleAssignmentApprovalStepsOperations:
+class ScopeRoleAssignmentApprovalStepsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -89,13 +91,12 @@ def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssig
:type approval_id: str
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentApprovalStepListResult or the result of cls(response)
:rtype:
~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -111,20 +112,18 @@ def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssig
)
cls: ClsType[_models.RoleAssignmentApprovalStepListResult] = kwargs.pop("cls", None)
- request = build_list_request(
+ _request = build_list_request(
approval_id=approval_id,
scope=scope,
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)
_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
@@ -134,11 +133,9 @@ def list(self, approval_id: str, scope: str, **kwargs: Any) -> _models.RoleAssig
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentApprovalStepListResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py
index 3da89379d0a1..3a15fd585ae4 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_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
@@ -28,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -85,7 +87,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -121,7 +141,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-03-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
@@ -141,12 +161,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py
index 6c0ba0427f19..dc5acdeb4ce2 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-03-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_metadata.json
index 9b441250f678..70f0f41bb470 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"operations": "Operations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_client.py
index ca6a9fc4c3b0..efd43a5b1984 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_authorization_management_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
@@ -28,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -85,7 +87,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -121,7 +141,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2021-03-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
@@ -141,12 +163,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_configuration.py
index fbaad4d60844..899dde321be6 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-03-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py
index 0bb9a6bebd04..b4ae1f3f59fa 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/__init__.py
@@ -5,23 +5,25 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._operations import Operations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # 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__ = [
@@ -35,5 +37,5 @@
"AccessReviewInstancesAssignedForMyApprovalOperations",
"AccessReviewInstanceMyDecisionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_operations.py
index aa90875c9933..545af652f6d5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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._access_review_default_settings_operations import build_get_request, build_put_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]]
@@ -56,12 +58,11 @@ def __init__(self, *args, **kwargs) -> None:
async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -77,19 +78,17 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -99,16 +98,12 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
async def put(
@@ -122,7 +117,6 @@ async def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -130,16 +124,15 @@ async def put(
@overload
async def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -147,23 +140,19 @@ async def put(
@distributed_trace_async
async def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_03_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,22 +177,20 @@ async def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -213,13 +200,9 @@ async def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_operations.py
index 2ea6cc3f2d42..378a84ec155e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_decisions_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._access_review_instance_decisions_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, schedule_definition_id: str, id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -68,7 +71,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -83,7 +85,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -94,18 +96,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -116,14 +116,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("AccessReviewDecisionListResult", pipeline_response)
@@ -133,11 +132,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
@@ -149,7 +148,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
index dcc1e43bb936..a18a9ff1582f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_my_decisions_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,26 +20,28 @@
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._access_review_instance_my_decisions_operations import (
build_get_by_id_request,
build_list_request,
build_patch_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 AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -63,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get my access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -74,7 +77,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -89,7 +91,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,17 +102,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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 +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
async def extract_data(pipeline_response):
deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response)
@@ -138,11 +137,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
@@ -155,10 +154,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace_async
async def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -171,12 +166,11 @@ async def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -192,21 +186,19 @@ async def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -216,16 +208,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
async def patch(
@@ -252,7 +240,6 @@ async def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -264,7 +251,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -278,11 +265,10 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -294,7 +280,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -306,18 +292,15 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_03_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -342,7 +325,7 @@ async def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -350,16 +333,14 @@ async def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -369,13 +350,9 @@ async def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_operations.py
index c6ba63176273..85635c5b1538 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instance_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,14 +17,12 @@
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._access_review_instance_operations import (
build_accept_recommendations_request,
build_apply_decisions_request,
@@ -33,6 +31,10 @@
build_stop_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]]
@@ -58,21 +60,18 @@ def __init__(self, *args, **kwargs) -> None:
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to stop an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -88,21 +87,19 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -113,28 +110,21 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def reset_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def reset_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to reset all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -150,21 +140,19 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -175,28 +163,21 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def apply_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def apply_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to apply all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -212,21 +193,19 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -237,28 +216,21 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def send_reminders( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def send_reminders(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to send reminders for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -274,21 +246,19 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -299,28 +269,21 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def accept_recommendations( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def accept_recommendations(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to accept recommendations for decision in an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -336,20 +299,18 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -360,8 +321,4 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
index 324318fbaa75..34d0bd191adf 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_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,25 +19,27 @@
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._access_review_instances_assigned_for_my_approval_operations import (
build_get_by_id_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]]
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -61,6 +63,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -70,7 +73,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -85,7 +87,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -96,16 +98,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
filter=filter,
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
@@ -116,14 +116,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("AccessReviewInstanceListResult", pipeline_response)
@@ -133,11 +132,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
@@ -150,10 +149,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -162,12 +157,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,20 +177,18 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -206,13 +198,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_operations.py
index 4092d7620e33..b17a6555c069 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_instances_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._access_review_instances_operations import build_get_by_id_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]]
@@ -58,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -67,7 +70,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -82,7 +84,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -93,17 +95,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -114,14 +114,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("AccessReviewInstanceListResult", pipeline_response)
@@ -131,11 +130,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,10 +147,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -160,12 +155,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,21 +175,19 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -205,13 +197,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index 8b866369d874..32ca054dc725 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_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,21 +19,23 @@
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._access_review_schedule_definitions_assigned_for_my_approval_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]]
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -64,7 +67,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -79,7 +81,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,15 +92,13 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -109,14 +109,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -126,11 +125,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
@@ -142,5 +141,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
index 0f992fe32c8f..e7a32422d5f1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_access_review_schedule_definitions_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._access_review_schedule_definitions_operations import (
build_create_or_update_by_id_request,
build_delete_by_id_request,
@@ -37,11 +35,15 @@
build_stop_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 AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -65,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -72,7 +75,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -87,7 +89,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,16 +100,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -118,14 +118,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -135,11 +134,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
@@ -152,22 +151,17 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,20 +177,18 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -206,31 +198,24 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete_by_id( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def delete_by_id(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Delete access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -246,20 +231,18 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -270,11 +253,7 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def create_or_update_by_id(
@@ -295,7 +274,6 @@ async def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -303,18 +281,22 @@ async def create_or_update_by_id(
@overload
async def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -324,7 +306,7 @@ async def create_or_update_by_id(
async def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -332,19 +314,15 @@ async def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -369,23 +347,21 @@ async def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -395,31 +371,24 @@ async def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Stop access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -435,20 +404,18 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -459,8 +426,4 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_operations.py
index 8b130fe18976..ea29424ebe24 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/aio/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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]]
@@ -57,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2021_03_01_preview.models.Operation]
@@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -82,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
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 +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("OperationListResult", pipeline_response)
@@ -117,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
@@ -133,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py
index c5e060119af7..e511aac3fe9c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py
@@ -5,45 +5,56 @@
# 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 AccessReviewDecision
-from ._models_py3 import AccessReviewDecisionIdentity
-from ._models_py3 import AccessReviewDecisionListResult
-from ._models_py3 import AccessReviewDecisionProperties
-from ._models_py3 import AccessReviewDecisionResource
-from ._models_py3 import AccessReviewDecisionServicePrincipalIdentity
-from ._models_py3 import AccessReviewDecisionUserIdentity
-from ._models_py3 import AccessReviewDefaultSettings
-from ._models_py3 import AccessReviewInstance
-from ._models_py3 import AccessReviewInstanceListResult
-from ._models_py3 import AccessReviewReviewer
-from ._models_py3 import AccessReviewScheduleDefinition
-from ._models_py3 import AccessReviewScheduleDefinitionListResult
-from ._models_py3 import AccessReviewScheduleDefinitionProperties
-from ._models_py3 import AccessReviewScheduleSettings
-from ._models_py3 import ErrorDefinition
-from ._models_py3 import ErrorDefinitionProperties
-from ._models_py3 import Operation
-from ._models_py3 import OperationDisplay
-from ._models_py3 import OperationListResult
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import AccessRecommendationType
-from ._authorization_management_client_enums import AccessReviewActorIdentityType
-from ._authorization_management_client_enums import AccessReviewApplyResult
-from ._authorization_management_client_enums import AccessReviewInstanceStatus
-from ._authorization_management_client_enums import AccessReviewRecurrencePatternType
-from ._authorization_management_client_enums import AccessReviewRecurrenceRangeType
-from ._authorization_management_client_enums import AccessReviewResult
-from ._authorization_management_client_enums import AccessReviewReviewerType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionReviewersType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionStatus
-from ._authorization_management_client_enums import AccessReviewScopeAssignmentState
-from ._authorization_management_client_enums import AccessReviewScopePrincipalType
-from ._authorization_management_client_enums import DecisionResourceType
-from ._authorization_management_client_enums import DecisionTargetType
-from ._authorization_management_client_enums import DefaultDecisionType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessReviewDecision,
+ AccessReviewDecisionIdentity,
+ AccessReviewDecisionListResult,
+ AccessReviewDecisionProperties,
+ AccessReviewDecisionResource,
+ AccessReviewDecisionServicePrincipalIdentity,
+ AccessReviewDecisionUserIdentity,
+ AccessReviewDefaultSettings,
+ AccessReviewInstance,
+ AccessReviewInstanceListResult,
+ AccessReviewReviewer,
+ AccessReviewScheduleDefinition,
+ AccessReviewScheduleDefinitionListResult,
+ AccessReviewScheduleDefinitionProperties,
+ AccessReviewScheduleSettings,
+ ErrorDefinition,
+ ErrorDefinitionProperties,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ AccessRecommendationType,
+ AccessReviewActorIdentityType,
+ AccessReviewApplyResult,
+ AccessReviewInstanceStatus,
+ AccessReviewRecurrencePatternType,
+ AccessReviewRecurrenceRangeType,
+ AccessReviewResult,
+ AccessReviewReviewerType,
+ AccessReviewScheduleDefinitionReviewersType,
+ AccessReviewScheduleDefinitionStatus,
+ AccessReviewScopeAssignmentState,
+ AccessReviewScopePrincipalType,
+ DecisionResourceType,
+ DecisionTargetType,
+ DefaultDecisionType,
+)
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__ = [
@@ -83,5 +94,5 @@
"DecisionTargetType",
"DefaultDecisionType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py
index 866793ed7b3b..548d7bbf9451 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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.
@@ -13,11 +13,10 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
-class AccessReviewDecision(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecision(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -205,7 +204,7 @@ class AccessReviewDecisionIdentity(_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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -276,7 +275,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewDecisionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecisionProperties(_serialization.Model):
"""Approval Step.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -426,7 +425,7 @@ class AccessReviewDecisionResource(_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 type: The type of resource. Required. "azureRole"
:vartype type: str or ~azure.mgmt.authorization.v2021_03_01_preview.models.DecisionResourceType
@@ -456,12 +455,12 @@ def __init__(self, **kwargs: Any) -> None:
self.display_name = None
-class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity):
+class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity): # pylint: disable=name-too-long
"""Service Principal Decision Target.
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -500,7 +499,7 @@ class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity):
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -534,7 +533,7 @@ def __init__(self, **kwargs: Any) -> None:
self.user_principal_name = None
-class AccessReviewDefaultSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDefaultSettings(_serialization.Model):
"""Access Review Default Settings.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -831,7 +830,7 @@ def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None
self.principal_type = None
-class AccessReviewScheduleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinition(_serialization.Model):
"""Access Review Schedule Definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1179,7 +1178,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewScheduleDefinitionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinitionProperties(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1461,7 +1460,7 @@ def __init__( # pylint: disable=too-many-locals
self.user_principal_name = None
-class AccessReviewScheduleSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleSettings(_serialization.Model):
"""Settings of an Access Review.
:ivar mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py
index 0bb9a6bebd04..b4ae1f3f59fa 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py
@@ -5,23 +5,25 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._operations import Operations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # 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__ = [
@@ -35,5 +37,5 @@
"AccessReviewInstancesAssignedForMyApprovalOperations",
"AccessReviewInstanceMyDecisionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py
index d7e6f83d0087..24c9502334e7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -116,12 +118,11 @@ def __init__(self, *args, **kwargs):
def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,19 +138,17 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -159,16 +158,12 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
def put(
@@ -182,7 +177,6 @@ def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -190,16 +184,15 @@ def put(
@overload
def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -207,23 +200,19 @@ def put(
@distributed_trace
def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_03_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,22 +237,20 @@ def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -273,13 +260,9 @@ def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py
index d60b6ad2d3e6..84fb24f212ce 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -104,7 +106,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -119,7 +120,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,18 +131,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -152,14 +151,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("AccessReviewDecisionListResult", pipeline_response)
@@ -169,11 +167,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
@@ -185,7 +183,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py
index 329036fc2560..8fad1bc0a942 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,7 +119,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -130,7 +132,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -165,7 +167,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -180,7 +181,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,17 +192,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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("AccessReviewDecisionListResult", 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": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace
def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -262,12 +256,11 @@ def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -283,21 +276,19 @@ def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -307,16 +298,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
def patch(
@@ -343,7 +330,6 @@ def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -355,7 +341,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -369,11 +355,10 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -385,7 +370,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -397,18 +382,15 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_03_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +415,7 @@ def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -441,16 +423,14 @@ def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -460,13 +440,9 @@ def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py
index 50abda50ab06..2e6012100269 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_reset_decisions_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -114,7 +116,7 @@ def build_apply_decisions_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -145,7 +147,7 @@ def build_send_reminders_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +175,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, *
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -214,12 +216,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -235,21 +236,19 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -260,11 +259,7 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def reset_decisions( # pylint: disable=inconsistent-return-statements
@@ -276,12 +271,11 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -297,21 +291,19 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -322,11 +314,7 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def apply_decisions( # pylint: disable=inconsistent-return-statements
@@ -338,12 +326,11 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -359,21 +346,19 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -384,11 +369,7 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def send_reminders( # pylint: disable=inconsistent-return-statements
@@ -400,12 +381,11 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -421,21 +401,19 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -446,11 +424,7 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def accept_recommendations( # pylint: disable=inconsistent-return-statements
@@ -462,12 +436,11 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -483,20 +456,18 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -507,8 +478,4 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
index 41ed9c6bc825..71befd922046 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -82,7 +84,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -93,7 +95,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -126,7 +128,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -141,7 +142,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -152,16 +153,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
filter=filter,
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
@@ -172,14 +171,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("AccessReviewInstanceListResult", pipeline_response)
@@ -189,11 +187,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
@@ -206,10 +204,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -218,12 +212,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -239,20 +232,18 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -262,13 +253,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py
index 80a4753c2734..b988dc228d6a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_list_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +88,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -130,7 +132,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -145,7 +146,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -156,17 +157,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -177,14 +176,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("AccessReviewInstanceListResult", pipeline_response)
@@ -194,11 +192,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
@@ -211,10 +209,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -223,12 +217,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -244,21 +237,19 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -268,13 +259,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index 00ed6fdbac0a..efad4d346ccc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_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]]
@@ -57,7 +59,7 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -79,6 +81,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -86,7 +89,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -101,7 +103,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -112,15 +114,13 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -131,14 +131,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -148,11 +147,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
@@ -164,5 +163,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py
index 101bd78385fb..730e4f3cec7b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, *
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -111,7 +113,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,7 +144,7 @@ def build_create_or_update_by_id_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -172,7 +174,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,7 +185,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -205,6 +207,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -212,7 +215,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -227,7 +229,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -238,16 +240,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -258,14 +258,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -275,11 +274,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
@@ -292,22 +291,17 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -323,20 +317,18 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -346,16 +338,12 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id( # pylint: disable=inconsistent-return-statements
@@ -365,12 +353,11 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -386,20 +373,18 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -410,11 +395,7 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def create_or_update_by_id(
@@ -435,7 +416,6 @@ def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -443,18 +423,22 @@ def create_or_update_by_id(
@overload
def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -464,7 +448,7 @@ def create_or_update_by_id(
def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -472,19 +456,15 @@ def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -509,23 +489,21 @@ def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -535,16 +513,12 @@ def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def stop( # pylint: disable=inconsistent-return-statements
@@ -554,12 +528,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -575,20 +548,18 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -599,8 +570,4 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py
index e59c4f92435e..e7f4b44fe769 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2021_03_01_preview.models.Operation]
@@ -93,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = 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.Operation"]:
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("OperationListResult", 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.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_client.py
index f4f80a6b47c8..25b29512a868 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_authorization_management_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
@@ -30,11 +33,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -95,7 +97,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -139,7 +159,7 @@ def __init__(
)
)
- 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
@@ -159,12 +179,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_configuration.py
index 95c3a123e29e..bee79a3dec2b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-07-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_metadata.json
index c1ad5b13cc4e..d97f7530313a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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": 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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"operations": "Operations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_client.py
index 58ec9e4d0fea..5fac5161c1b1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_authorization_management_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
@@ -30,11 +33,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -95,7 +97,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -139,7 +159,9 @@ def __init__(
)
)
- 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
@@ -159,12 +181,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_configuration.py
index 0972d8eedae4..c7004a379ad6 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-07-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py
index dda9abe5b586..d0bf6e552fc9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/__init__.py
@@ -5,27 +5,27 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._operations import Operations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
-from ._tenant_level_access_review_instance_contacted_reviewers_operations import (
- TenantLevelAccessReviewInstanceContactedReviewersOperations,
-)
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # type: ignore
+from ._tenant_level_access_review_instance_contacted_reviewers_operations import TenantLevelAccessReviewInstanceContactedReviewersOperations # 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__ = [
@@ -41,5 +41,5 @@
"AccessReviewInstanceMyDecisionsOperations",
"TenantLevelAccessReviewInstanceContactedReviewersOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_operations.py
index b45ea7aa5b68..f7ea2547ce87 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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._access_review_default_settings_operations import build_get_request, build_put_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]]
@@ -56,12 +58,11 @@ def __init__(self, *args, **kwargs) -> None:
async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -77,19 +78,17 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -99,16 +98,12 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
async def put(
@@ -122,7 +117,6 @@ async def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -130,16 +124,15 @@ async def put(
@overload
async def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -147,23 +140,19 @@ async def put(
@distributed_trace_async
async def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_07_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,22 +177,20 @@ async def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -213,13 +200,9 @@ async def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py
index 47489dcd5700..aede24db62fe 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_contacted_reviewers_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,21 +19,23 @@
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._access_review_instance_contacted_reviewers_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]]
-class AccessReviewInstanceContactedReviewersOperations:
+class AccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = 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(
schedule_definition_id=schedule_definition_id,
id=id,
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("AccessReviewContactedReviewerListResult", 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.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_operations.py
index 0a0b1e152442..3c97bd1824dc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_decisions_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._access_review_instance_decisions_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, schedule_definition_id: str, id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -68,7 +71,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -83,7 +85,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -94,18 +96,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -116,14 +116,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("AccessReviewDecisionListResult", pipeline_response)
@@ -133,11 +132,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
@@ -149,7 +148,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
index 0690b78e1e5a..0750ded9d8b9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_my_decisions_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,26 +20,28 @@
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._access_review_instance_my_decisions_operations import (
build_get_by_id_request,
build_list_request,
build_patch_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 AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -63,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get my access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -74,7 +77,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -89,7 +91,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,17 +102,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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 +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
async def extract_data(pipeline_response):
deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response)
@@ -138,11 +137,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
@@ -155,10 +154,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace_async
async def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -171,12 +166,11 @@ async def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -192,21 +186,19 @@ async def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -216,16 +208,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
async def patch(
@@ -252,7 +240,6 @@ async def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -264,7 +251,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -278,11 +265,10 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -294,7 +280,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -306,18 +292,15 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_07_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -342,7 +325,7 @@ async def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -350,16 +333,14 @@ async def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -369,13 +350,9 @@ async def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_operations.py
index ef3aba0b7ede..f220ee75ce7d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instance_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,14 +17,12 @@
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._access_review_instance_operations import (
build_accept_recommendations_request,
build_apply_decisions_request,
@@ -33,6 +31,10 @@
build_stop_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]]
@@ -58,21 +60,18 @@ def __init__(self, *args, **kwargs) -> None:
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to stop an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -88,21 +87,19 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -113,28 +110,21 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def reset_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def reset_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to reset all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -150,21 +140,19 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -175,28 +163,21 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def apply_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def apply_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to apply all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -212,21 +193,19 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -237,28 +216,21 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def send_reminders( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def send_reminders(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to send reminders for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -274,21 +246,19 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -299,28 +269,21 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def accept_recommendations( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def accept_recommendations(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to accept recommendations for decision in an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -336,20 +299,18 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -360,8 +321,4 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
index 84b325b2e4ec..08a06ed963b1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_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,25 +19,27 @@
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._access_review_instances_assigned_for_my_approval_operations import (
build_get_by_id_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]]
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -61,6 +63,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -70,7 +73,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -85,7 +87,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -96,16 +98,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
filter=filter,
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
@@ -116,14 +116,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("AccessReviewInstanceListResult", pipeline_response)
@@ -133,11 +132,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
@@ -150,10 +149,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -162,12 +157,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,20 +177,18 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -206,13 +198,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_operations.py
index 255209641f6c..e0a53a6ba58e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_instances_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,21 +20,23 @@
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._access_review_instances_operations import (
build_create_request,
build_get_by_id_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 __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -72,7 +75,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -87,7 +89,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,17 +100,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -119,14 +119,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("AccessReviewInstanceListResult", pipeline_response)
@@ -136,11 +135,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
@@ -153,10 +152,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -165,12 +160,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -186,21 +180,19 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -210,16 +202,12 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
@overload
async def create(
@@ -243,7 +231,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: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -254,7 +241,7 @@ async def create(
self,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -266,11 +253,10 @@ async def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance 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
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -281,7 +267,7 @@ async def create(
self,
schedule_definition_id: str,
id: str,
- properties: Union[_models.AccessReviewInstanceProperties, IO],
+ properties: Union[_models.AccessReviewInstanceProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewInstance:
"""Update access review instance.
@@ -291,18 +277,15 @@ async def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance properties. Is either a
- AccessReviewInstanceProperties type or a IO type. Required.
+ AccessReviewInstanceProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstanceProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_07_01_preview.models.AccessReviewInstanceProperties or
+ IO[bytes]
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -327,7 +310,7 @@ async def create(
else:
_json = self._serialize.body(properties, "AccessReviewInstanceProperties")
- request = build_create_request(
+ _request = build_create_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
@@ -335,16 +318,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
@@ -354,13 +335,9 @@ async def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", 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}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index 1d4319be31b7..0049d38c5633 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_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,21 +19,23 @@
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._access_review_schedule_definitions_assigned_for_my_approval_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]]
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -64,7 +67,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -79,7 +81,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,15 +92,13 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -109,14 +109,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -126,11 +125,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
@@ -142,5 +141,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
index 3c1436545a90..3709dcc113e3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_access_review_schedule_definitions_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._access_review_schedule_definitions_operations import (
build_create_or_update_by_id_request,
build_delete_by_id_request,
@@ -37,11 +35,15 @@
build_stop_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 AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -65,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -72,7 +75,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -87,7 +89,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,16 +100,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -118,14 +118,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -135,11 +134,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
@@ -152,22 +151,17 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,20 +177,18 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -206,31 +198,24 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete_by_id( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def delete_by_id(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Delete access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -246,20 +231,18 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -270,11 +253,7 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def create_or_update_by_id(
@@ -295,7 +274,6 @@ async def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -303,18 +281,22 @@ async def create_or_update_by_id(
@overload
async def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -324,7 +306,7 @@ async def create_or_update_by_id(
async def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -332,19 +314,15 @@ async def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -369,23 +347,21 @@ async def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -395,31 +371,24 @@ async def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Stop access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -435,20 +404,18 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -459,8 +426,4 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_operations.py
index e8116873c26a..2ff9072091b7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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]]
@@ -57,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2021_07_01_preview.models.Operation]
@@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -82,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
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 +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("OperationListResult", pipeline_response)
@@ -117,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
@@ -133,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
index a4616c3cfbc9..4f2201a88b83 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_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,21 +19,23 @@
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._tenant_level_access_review_instance_contacted_reviewers_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]]
-class TenantLevelAccessReviewInstanceContactedReviewersOperations:
+class TenantLevelAccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,16 +91,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=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
@@ -109,14 +109,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("AccessReviewContactedReviewerListResult", pipeline_response)
@@ -126,11 +125,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
@@ -142,7 +141,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py
index 2d6f150deeda..ae8674a8fa05 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/__init__.py
@@ -5,49 +5,60 @@
# 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 AccessReviewContactedReviewer
-from ._models_py3 import AccessReviewContactedReviewerListResult
-from ._models_py3 import AccessReviewDecision
-from ._models_py3 import AccessReviewDecisionIdentity
-from ._models_py3 import AccessReviewDecisionListResult
-from ._models_py3 import AccessReviewDecisionProperties
-from ._models_py3 import AccessReviewDecisionResource
-from ._models_py3 import AccessReviewDecisionServicePrincipalIdentity
-from ._models_py3 import AccessReviewDecisionUserIdentity
-from ._models_py3 import AccessReviewDefaultSettings
-from ._models_py3 import AccessReviewInstance
-from ._models_py3 import AccessReviewInstanceListResult
-from ._models_py3 import AccessReviewInstanceProperties
-from ._models_py3 import AccessReviewReviewer
-from ._models_py3 import AccessReviewScheduleDefinition
-from ._models_py3 import AccessReviewScheduleDefinitionListResult
-from ._models_py3 import AccessReviewScheduleDefinitionProperties
-from ._models_py3 import AccessReviewScheduleSettings
-from ._models_py3 import ErrorDefinition
-from ._models_py3 import ErrorDefinitionProperties
-from ._models_py3 import Operation
-from ._models_py3 import OperationDisplay
-from ._models_py3 import OperationListResult
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import AccessRecommendationType
-from ._authorization_management_client_enums import AccessReviewActorIdentityType
-from ._authorization_management_client_enums import AccessReviewApplyResult
-from ._authorization_management_client_enums import AccessReviewInstanceReviewersType
-from ._authorization_management_client_enums import AccessReviewInstanceStatus
-from ._authorization_management_client_enums import AccessReviewRecurrencePatternType
-from ._authorization_management_client_enums import AccessReviewRecurrenceRangeType
-from ._authorization_management_client_enums import AccessReviewResult
-from ._authorization_management_client_enums import AccessReviewReviewerType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionReviewersType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionStatus
-from ._authorization_management_client_enums import AccessReviewScopeAssignmentState
-from ._authorization_management_client_enums import AccessReviewScopePrincipalType
-from ._authorization_management_client_enums import DecisionResourceType
-from ._authorization_management_client_enums import DecisionTargetType
-from ._authorization_management_client_enums import DefaultDecisionType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessReviewContactedReviewer,
+ AccessReviewContactedReviewerListResult,
+ AccessReviewDecision,
+ AccessReviewDecisionIdentity,
+ AccessReviewDecisionListResult,
+ AccessReviewDecisionProperties,
+ AccessReviewDecisionResource,
+ AccessReviewDecisionServicePrincipalIdentity,
+ AccessReviewDecisionUserIdentity,
+ AccessReviewDefaultSettings,
+ AccessReviewInstance,
+ AccessReviewInstanceListResult,
+ AccessReviewInstanceProperties,
+ AccessReviewReviewer,
+ AccessReviewScheduleDefinition,
+ AccessReviewScheduleDefinitionListResult,
+ AccessReviewScheduleDefinitionProperties,
+ AccessReviewScheduleSettings,
+ ErrorDefinition,
+ ErrorDefinitionProperties,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ AccessRecommendationType,
+ AccessReviewActorIdentityType,
+ AccessReviewApplyResult,
+ AccessReviewInstanceReviewersType,
+ AccessReviewInstanceStatus,
+ AccessReviewRecurrencePatternType,
+ AccessReviewRecurrenceRangeType,
+ AccessReviewResult,
+ AccessReviewReviewerType,
+ AccessReviewScheduleDefinitionReviewersType,
+ AccessReviewScheduleDefinitionStatus,
+ AccessReviewScopeAssignmentState,
+ AccessReviewScopePrincipalType,
+ DecisionResourceType,
+ DecisionTargetType,
+ DefaultDecisionType,
+)
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__ = [
@@ -91,5 +102,5 @@
"DecisionTargetType",
"DefaultDecisionType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/_models_py3.py
index 3d2415396bf5..23fe32769caa 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_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.
@@ -13,7 +13,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -99,7 +98,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewDecision(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecision(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -287,7 +286,7 @@ class AccessReviewDecisionIdentity(_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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -358,7 +357,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewDecisionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecisionProperties(_serialization.Model):
"""Approval Step.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -508,7 +507,7 @@ class AccessReviewDecisionResource(_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 type: The type of resource. Required. "azureRole"
:vartype type: str or ~azure.mgmt.authorization.v2021_07_01_preview.models.DecisionResourceType
@@ -538,12 +537,12 @@ def __init__(self, **kwargs: Any) -> None:
self.display_name = None
-class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity):
+class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity): # pylint: disable=name-too-long
"""Service Principal Decision Target.
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -582,7 +581,7 @@ class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity):
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -616,7 +615,7 @@ def __init__(self, **kwargs: Any) -> None:
self.user_principal_name = None
-class AccessReviewDefaultSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDefaultSettings(_serialization.Model):
"""Access Review Default Settings.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1031,7 +1030,7 @@ def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None
self.principal_type = None
-class AccessReviewScheduleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinition(_serialization.Model):
"""Access Review Schedule Definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1410,7 +1409,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewScheduleDefinitionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinitionProperties(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1720,7 +1719,7 @@ def __init__( # pylint: disable=too-many-locals
self.user_principal_name = None
-class AccessReviewScheduleSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleSettings(_serialization.Model):
"""Settings of an Access Review.
:ivar mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py
index dda9abe5b586..d0bf6e552fc9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/__init__.py
@@ -5,27 +5,27 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+# pylint: disable=wrong-import-position
-from ._operations import Operations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
-from ._tenant_level_access_review_instance_contacted_reviewers_operations import (
- TenantLevelAccessReviewInstanceContactedReviewersOperations,
-)
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # type: ignore
+from ._tenant_level_access_review_instance_contacted_reviewers_operations import TenantLevelAccessReviewInstanceContactedReviewersOperations # 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__ = [
@@ -41,5 +41,5 @@
"AccessReviewInstanceMyDecisionsOperations",
"TenantLevelAccessReviewInstanceContactedReviewersOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py
index f8b6d3a3d816..98afc13aad3e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -116,12 +118,11 @@ def __init__(self, *args, **kwargs):
def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,19 +138,17 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -159,16 +158,12 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
def put(
@@ -182,7 +177,6 @@ def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -190,16 +184,15 @@ def put(
@overload
def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -207,23 +200,19 @@ def put(
@distributed_trace
def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_07_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,22 +237,20 @@ def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -273,13 +260,9 @@ def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py
index 19b8ad38430f..7b2c48cbce46 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -65,7 +67,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstanceContactedReviewersOperations:
+class AccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -89,13 +91,13 @@ def __init__(self, *args, **kwargs):
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> Iterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -110,7 +112,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = 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(
schedule_definition_id=schedule_definition_id,
id=id,
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("AccessReviewContactedReviewerListResult", 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.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py
index f6c1fc47e437..17b7247d4b0b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -104,7 +106,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -119,7 +120,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,18 +131,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -152,14 +151,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("AccessReviewDecisionListResult", pipeline_response)
@@ -169,11 +167,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
@@ -185,7 +183,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py
index f1f5b55e4b6f..2eb64e153daf 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,7 +119,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -130,7 +132,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -165,7 +167,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -180,7 +181,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,17 +192,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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("AccessReviewDecisionListResult", 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": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace
def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -262,12 +256,11 @@ def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -283,21 +276,19 @@ def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -307,16 +298,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
def patch(
@@ -343,7 +330,6 @@ def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -355,7 +341,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -369,11 +355,10 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -385,7 +370,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -397,18 +382,15 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_07_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +415,7 @@ def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -441,16 +423,14 @@ def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -460,13 +440,9 @@ def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py
index ca56aff5c029..0ee9ca7919a1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_reset_decisions_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -114,7 +116,7 @@ def build_apply_decisions_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -145,7 +147,7 @@ def build_send_reminders_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +175,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, *
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -214,12 +216,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -235,21 +236,19 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -260,11 +259,7 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def reset_decisions( # pylint: disable=inconsistent-return-statements
@@ -276,12 +271,11 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -297,21 +291,19 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -322,11 +314,7 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def apply_decisions( # pylint: disable=inconsistent-return-statements
@@ -338,12 +326,11 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -359,21 +346,19 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -384,11 +369,7 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def send_reminders( # pylint: disable=inconsistent-return-statements
@@ -400,12 +381,11 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -421,21 +401,19 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -446,11 +424,7 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def accept_recommendations( # pylint: disable=inconsistent-return-statements
@@ -462,12 +436,11 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -483,20 +456,18 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -507,8 +478,4 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
index b33a2aa2103a..b543578ef8be 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -82,7 +84,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -93,7 +95,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -126,7 +128,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -141,7 +142,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -152,16 +153,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
filter=filter,
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
@@ -172,14 +171,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("AccessReviewInstanceListResult", pipeline_response)
@@ -189,11 +187,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
@@ -206,10 +204,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -218,12 +212,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -239,20 +232,18 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -262,13 +253,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py
index d92292975e9f..fcf440066ab1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,7 +119,7 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -163,7 +165,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -178,7 +179,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -189,17 +190,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -210,14 +209,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("AccessReviewInstanceListResult", pipeline_response)
@@ -227,11 +225,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
@@ -244,10 +242,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -256,12 +250,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -277,21 +270,19 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -301,16 +292,12 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
@overload
def create(
@@ -334,7 +321,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: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -345,7 +331,7 @@ def create(
self,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -357,11 +343,10 @@ def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance 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
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -372,7 +357,7 @@ def create(
self,
schedule_definition_id: str,
id: str,
- properties: Union[_models.AccessReviewInstanceProperties, IO],
+ properties: Union[_models.AccessReviewInstanceProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewInstance:
"""Update access review instance.
@@ -382,18 +367,15 @@ def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance properties. Is either a
- AccessReviewInstanceProperties type or a IO type. Required.
+ AccessReviewInstanceProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstanceProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_07_01_preview.models.AccessReviewInstanceProperties or
+ IO[bytes]
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,7 +400,7 @@ def create(
else:
_json = self._serialize.body(properties, "AccessReviewInstanceProperties")
- request = build_create_request(
+ _request = build_create_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
@@ -426,16 +408,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
@@ -445,13 +425,9 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", 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}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index 30a816283b29..4998eb91066c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_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]]
@@ -57,7 +59,7 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -79,6 +81,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -86,7 +89,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -101,7 +103,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -112,15 +114,13 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -131,14 +131,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -148,11 +147,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
@@ -164,5 +163,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py
index da73e4b91a1a..019a7f05e26e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, *
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -111,7 +113,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,7 +144,7 @@ def build_create_or_update_by_id_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -172,7 +174,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,7 +185,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -205,6 +207,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -212,7 +215,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -227,7 +229,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -238,16 +240,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -258,14 +258,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -275,11 +274,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
@@ -292,22 +291,17 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -323,20 +317,18 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -346,16 +338,12 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id( # pylint: disable=inconsistent-return-statements
@@ -365,12 +353,11 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -386,20 +373,18 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -410,11 +395,7 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def create_or_update_by_id(
@@ -435,7 +416,6 @@ def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -443,18 +423,22 @@ def create_or_update_by_id(
@overload
def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -464,7 +448,7 @@ def create_or_update_by_id(
def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -472,19 +456,15 @@ def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_07_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -509,23 +489,21 @@ def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -535,16 +513,12 @@ def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def stop( # pylint: disable=inconsistent-return-statements
@@ -554,12 +528,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -575,20 +548,18 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -599,8 +570,4 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_operations.py
index 255bf222b33f..9950b99e7a98 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_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]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2021_07_01_preview.models.Operation]
@@ -93,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = 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.Operation"]:
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("OperationListResult", 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.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
index 38730f35e65f..db769f40a4dc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -64,7 +66,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class TenantLevelAccessReviewInstanceContactedReviewersOperations:
+class TenantLevelAccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -88,13 +90,13 @@ def __init__(self, *args, **kwargs):
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> Iterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -109,7 +111,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -120,16 +122,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=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
@@ -140,14 +140,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("AccessReviewContactedReviewerListResult", pipeline_response)
@@ -157,11 +156,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
@@ -173,7 +172,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_client.py
index 13a9f000d386..5e2929cdf4d7 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_authorization_management_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
@@ -44,11 +47,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -161,7 +163,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -247,7 +267,7 @@ def __init__(
)
)
- 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
@@ -267,12 +287,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_configuration.py
index 3e20a7c4c988..6665154ae6e9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-12-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_metadata.json
index 2e1c41594826..ba0d7751a8f8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"operations": "Operations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_client.py
index aa83068b7f1d..f9de04e087e5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_authorization_management_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
@@ -44,11 +47,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class AuthorizationManagementClient: # pylint: disable=too-many-instance-attributes
"""Access reviews service provides the workflow for running access reviews on different kind of
resources.
@@ -161,7 +163,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -247,7 +267,9 @@ def __init__(
)
)
- 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
@@ -267,12 +289,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_configuration.py
index 7c6c3db83976..c15c77b80453 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2021-12-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py
index d04d147885dc..37b69755bdf5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/__init__.py
@@ -5,47 +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 ._operations import Operations
-from ._access_review_history_definitions_operations import AccessReviewHistoryDefinitionsOperations
-from ._access_review_history_definition_operations import AccessReviewHistoryDefinitionOperations
-from ._access_review_history_definition_instance_operations import AccessReviewHistoryDefinitionInstanceOperations
-from ._access_review_history_definition_instances_operations import AccessReviewHistoryDefinitionInstancesOperations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._scope_access_review_history_definitions_operations import ScopeAccessReviewHistoryDefinitionsOperations
-from ._scope_access_review_history_definition_operations import ScopeAccessReviewHistoryDefinitionOperations
-from ._scope_access_review_history_definition_instance_operations import (
- ScopeAccessReviewHistoryDefinitionInstanceOperations,
-)
-from ._scope_access_review_history_definition_instances_operations import (
- ScopeAccessReviewHistoryDefinitionInstancesOperations,
-)
-from ._scope_access_review_schedule_definitions_operations import ScopeAccessReviewScheduleDefinitionsOperations
-from ._scope_access_review_instances_operations import ScopeAccessReviewInstancesOperations
-from ._scope_access_review_instance_operations import ScopeAccessReviewInstanceOperations
-from ._scope_access_review_instance_decisions_operations import ScopeAccessReviewInstanceDecisionsOperations
-from ._scope_access_review_instance_contacted_reviewers_operations import (
- ScopeAccessReviewInstanceContactedReviewersOperations,
-)
-from ._scope_access_review_default_settings_operations import ScopeAccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
-from ._tenant_level_access_review_instance_contacted_reviewers_operations import (
- TenantLevelAccessReviewInstanceContactedReviewersOperations,
-)
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_history_definitions_operations import AccessReviewHistoryDefinitionsOperations # type: ignore
+from ._access_review_history_definition_operations import AccessReviewHistoryDefinitionOperations # type: ignore
+from ._access_review_history_definition_instance_operations import AccessReviewHistoryDefinitionInstanceOperations # type: ignore
+from ._access_review_history_definition_instances_operations import AccessReviewHistoryDefinitionInstancesOperations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._scope_access_review_history_definitions_operations import ScopeAccessReviewHistoryDefinitionsOperations # type: ignore
+from ._scope_access_review_history_definition_operations import ScopeAccessReviewHistoryDefinitionOperations # type: ignore
+from ._scope_access_review_history_definition_instance_operations import ScopeAccessReviewHistoryDefinitionInstanceOperations # type: ignore
+from ._scope_access_review_history_definition_instances_operations import ScopeAccessReviewHistoryDefinitionInstancesOperations # type: ignore
+from ._scope_access_review_schedule_definitions_operations import ScopeAccessReviewScheduleDefinitionsOperations # type: ignore
+from ._scope_access_review_instances_operations import ScopeAccessReviewInstancesOperations # type: ignore
+from ._scope_access_review_instance_operations import ScopeAccessReviewInstanceOperations # type: ignore
+from ._scope_access_review_instance_decisions_operations import ScopeAccessReviewInstanceDecisionsOperations # type: ignore
+from ._scope_access_review_instance_contacted_reviewers_operations import ScopeAccessReviewInstanceContactedReviewersOperations # type: ignore
+from ._scope_access_review_default_settings_operations import ScopeAccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # type: ignore
+from ._tenant_level_access_review_instance_contacted_reviewers_operations import TenantLevelAccessReviewInstanceContactedReviewersOperations # 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__ = [
@@ -75,5 +69,5 @@
"AccessReviewInstanceMyDecisionsOperations",
"TenantLevelAccessReviewInstanceContactedReviewersOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_operations.py
index 52327653b7f3..6eeb6daaca55 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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._access_review_default_settings_operations import build_get_request, build_put_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]]
@@ -56,12 +58,11 @@ def __init__(self, *args, **kwargs) -> None:
async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -77,19 +78,17 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -99,16 +98,12 @@ async def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
async def put(
@@ -122,7 +117,6 @@ async def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -130,16 +124,15 @@ async def put(
@overload
async def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -147,23 +140,19 @@ async def put(
@distributed_trace_async
async def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,22 +177,20 @@ async def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -213,13 +200,9 @@ async def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_operations.py
index 19054fa67e9f..55f2e86ea47a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instance_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,21 +17,23 @@
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._access_review_history_definition_instance_operations import build_generate_download_uri_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 AccessReviewHistoryDefinitionInstanceOperations:
+class AccessReviewHistoryDefinitionInstanceOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -63,12 +65,11 @@ async def generate_download_uri(
:param instance_id: The id of the access review history definition instance to generate a URI
for. Required.
:type instance_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,21 +85,19 @@ async def generate_download_uri(
)
cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None)
- request = build_generate_download_uri_request(
+ _request = build_generate_download_uri_request(
history_definition_id=history_definition_id,
instance_id=instance_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.generate_download_uri.metadata["url"],
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,13 +107,9 @@ async def generate_download_uri(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- generate_download_uri.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_operations.py
index 2d55e63dfc3c..3828a7f538dd 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_instances_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,21 +19,23 @@
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._access_review_history_definition_instances_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]]
-class AccessReviewHistoryDefinitionInstancesOperations:
+class AccessReviewHistoryDefinitionInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -55,11 +57,11 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace
def list(self, history_definition_id: str, **kwargs: Any) -> AsyncIterable["_models.AccessReviewHistoryInstance"]:
+ # pylint: disable=line-too-long
"""Get access review history definition instances by definition Id.
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryInstance or the result of
cls(response)
:rtype:
@@ -74,7 +76,7 @@ def list(self, history_definition_id: str, **kwargs: Any) -> AsyncIterable["_mod
)
cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,16 +87,14 @@ def list(self, history_definition_id: str, **kwargs: Any) -> AsyncIterable["_mod
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
history_definition_id=history_definition_id,
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
@@ -105,14 +105,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("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response)
@@ -122,11 +121,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
@@ -138,7 +137,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_operations.py
index d666347c29aa..b5a27754a602 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definition_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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._access_review_history_definition_operations import build_create_request, build_delete_by_id_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]]
@@ -71,7 +73,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: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -79,18 +80,22 @@ async def create(
@overload
async def create(
- self, history_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ history_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewHistoryDefinition:
"""Create a scheduled or one-time Access Review History Definition.
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition 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
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -100,7 +105,7 @@ async def create(
async def create(
self,
history_definition_id: str,
- properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewHistoryDefinition:
"""Create a scheduled or one-time Access Review History Definition.
@@ -108,19 +113,15 @@ async def create(
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition properties. Is either a
- AccessReviewHistoryDefinitionProperties type or a IO type. Required.
+ AccessReviewHistoryDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,23 +146,21 @@ async def create(
else:
_json = self._serialize.body(properties, "AccessReviewHistoryDefinitionProperties")
- request = build_create_request(
+ _request = build_create_request(
history_definition_id=history_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -171,31 +170,24 @@ async def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete_by_id( # pylint: disable=inconsistent-return-statements
- self, history_definition_id: str, **kwargs: Any
- ) -> None:
+ async def delete_by_id(self, history_definition_id: str, **kwargs: Any) -> None:
"""Delete an access review history definition.
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: 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,
@@ -211,20 +203,18 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
history_definition_id=history_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -235,8 +225,4 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_operations.py
index c0104ae55246..b9dbe19ea05e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_history_definitions_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._access_review_history_definitions_operations import build_get_by_id_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]]
@@ -58,13 +60,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewHistoryDefinition"]:
+ # pylint: disable=line-too-long
"""Lists the accessReviewHistoryDefinitions available from this provider, definition instances are
only available for 30 days after creation.
:param filter: The filter to apply on the operation. Only standard filters on definition name
and created date are supported. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryDefinition or the result of
cls(response)
:rtype:
@@ -79,7 +81,7 @@ def list(
)
cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,16 +92,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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("AccessReviewHistoryDefinitionListResult", 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
@@ -144,22 +143,17 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"
- }
-
@distributed_trace_async
async def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.AccessReviewHistoryDefinition:
"""Get access review history definition by definition Id.
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -175,20 +169,18 @@ async def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.
)
cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
history_definition_id=history_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -198,13 +190,9 @@ async def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py
index 90c547171108..2609fcbf9d98 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_contacted_reviewers_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,21 +19,23 @@
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._access_review_instance_contacted_reviewers_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]]
-class AccessReviewInstanceContactedReviewersOperations:
+class AccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = 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(
schedule_definition_id=schedule_definition_id,
id=id,
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("AccessReviewContactedReviewerListResult", 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.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_operations.py
index 7b6e6c3cc8a2..8442a253e501 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_decisions_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._access_review_instance_decisions_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, schedule_definition_id: str, id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -68,7 +71,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -83,7 +85,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -94,18 +96,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -116,14 +116,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("AccessReviewDecisionListResult", pipeline_response)
@@ -133,11 +132,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
@@ -149,7 +148,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
index 05e1a248f909..d9cace36df25 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_my_decisions_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,26 +20,28 @@
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._access_review_instance_my_decisions_operations import (
build_get_by_id_request,
build_list_request,
build_patch_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 AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -63,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get my access review instance decisions.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -74,7 +77,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -89,7 +91,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,17 +102,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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 +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
async def extract_data(pipeline_response):
deserialized = self._deserialize("AccessReviewDecisionListResult", pipeline_response)
@@ -138,11 +137,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
@@ -155,10 +154,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace_async
async def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -171,12 +166,11 @@ async def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -192,21 +186,19 @@ async def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -216,16 +208,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
async def patch(
@@ -252,7 +240,6 @@ async def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -264,7 +251,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -278,11 +265,10 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -294,7 +280,7 @@ async def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -306,18 +292,15 @@ async def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -342,7 +325,7 @@ async def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -350,16 +333,14 @@ async def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -369,13 +350,9 @@ async def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_operations.py
index bf8e8e0ab3d8..3e97da241b6d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instance_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,14 +17,12 @@
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._access_review_instance_operations import (
build_accept_recommendations_request,
build_apply_decisions_request,
@@ -33,6 +31,10 @@
build_stop_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]]
@@ -58,21 +60,18 @@ def __init__(self, *args, **kwargs) -> None:
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to stop an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -88,21 +87,19 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -113,28 +110,21 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def reset_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def reset_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to reset all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -150,21 +140,19 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -175,28 +163,21 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def apply_decisions( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def apply_decisions(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to apply all decisions for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -212,21 +193,19 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -237,28 +216,21 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def send_reminders( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def send_reminders(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to send reminders for an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -274,21 +246,19 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -299,28 +269,21 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def accept_recommendations( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def accept_recommendations(self, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to accept recommendations for decision in an access review instance.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -336,20 +299,18 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -360,8 +321,4 @@ async def accept_recommendations( # pylint: disable=inconsistent-return-stateme
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
index 2f93b7d715eb..e7312503fb94 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_assigned_for_my_approval_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,25 +19,27 @@
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._access_review_instances_assigned_for_my_approval_operations import (
build_get_by_id_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]]
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -61,6 +63,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -70,7 +73,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -85,7 +87,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -96,16 +98,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
filter=filter,
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
@@ -116,14 +116,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("AccessReviewInstanceListResult", pipeline_response)
@@ -133,11 +132,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
@@ -150,10 +149,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -162,12 +157,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,20 +177,18 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -206,13 +198,9 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_operations.py
index e7b6e5ab3458..c253f0fb0b54 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_instances_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,21 +20,23 @@
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._access_review_instances_operations import (
build_create_request,
build_get_by_id_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 __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances.
:param schedule_definition_id: The id of the access review schedule definition. Required.
@@ -72,7 +75,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -87,7 +89,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,17 +100,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -119,14 +119,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("AccessReviewInstanceListResult", pipeline_response)
@@ -136,11 +135,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
@@ -153,10 +152,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -165,12 +160,11 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -186,21 +180,19 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -210,16 +202,12 @@ async def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
@overload
async def create(
@@ -243,7 +231,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: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -254,7 +241,7 @@ async def create(
self,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -266,11 +253,10 @@ async def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance 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
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -281,7 +267,7 @@ async def create(
self,
schedule_definition_id: str,
id: str,
- properties: Union[_models.AccessReviewInstanceProperties, IO],
+ properties: Union[_models.AccessReviewInstanceProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewInstance:
"""Update access review instance.
@@ -291,18 +277,15 @@ async def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance properties. Is either a
- AccessReviewInstanceProperties type or a IO type. Required.
+ AccessReviewInstanceProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or
+ IO[bytes]
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -327,7 +310,7 @@ async def create(
else:
_json = self._serialize.body(properties, "AccessReviewInstanceProperties")
- request = build_create_request(
+ _request = build_create_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
@@ -335,16 +318,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
@@ -354,13 +335,9 @@ async def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", 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}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index 784c30e2d082..76676cf7cb0f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_assigned_for_my_approval_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,21 +19,23 @@
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._access_review_schedule_definitions_assigned_for_my_approval_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]]
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -64,7 +67,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -79,7 +81,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -90,15 +92,13 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -109,14 +109,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -126,11 +125,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
@@ -142,5 +141,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
index e2b57209e862..e78018f352bf 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_access_review_schedule_definitions_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._access_review_schedule_definitions_operations import (
build_create_or_update_by_id_request,
build_delete_by_id_request,
@@ -37,11 +35,15 @@
build_stop_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 AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -65,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -72,7 +75,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -87,7 +89,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -98,16 +100,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -118,14 +118,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -135,11 +134,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
@@ -152,22 +151,17 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace_async
async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,20 +177,18 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -206,31 +198,24 @@ async def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete_by_id( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def delete_by_id(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Delete access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -246,20 +231,18 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -270,11 +253,7 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def create_or_update_by_id(
@@ -295,7 +274,6 @@ async def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -303,18 +281,22 @@ async def create_or_update_by_id(
@overload
async def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -324,7 +306,7 @@ async def create_or_update_by_id(
async def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -332,19 +314,15 @@ async def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -369,23 +347,21 @@ async def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -395,31 +371,24 @@ async def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, schedule_definition_id: str, **kwargs: Any) -> None:
"""Stop access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -435,20 +404,18 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -459,8 +426,4 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_operations.py
index 393af574b8e3..7551e5c57206 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_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]]
@@ -57,7 +59,6 @@ def __init__(self, *args, **kwargs) -> None:
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2021_12_01_preview.models.Operation]
@@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -82,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
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 +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("OperationListResult", pipeline_response)
@@ -117,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
@@ -133,5 +131,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_operations.py
index 3cf432e09ae3..2ea0dcc85792 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,21 +18,23 @@
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._scope_access_review_default_settings_operations import build_get_request, build_put_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 ScopeAccessReviewDefaultSettingsOperations:
+class ScopeAccessReviewDefaultSettingsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -58,12 +60,11 @@ async def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSet
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -79,19 +80,17 @@ async def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSet
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
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
@@ -101,14 +100,12 @@ async def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSet
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"}
+ return deserialized # type: ignore
@overload
async def put(
@@ -129,7 +126,6 @@ async def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -137,18 +133,17 @@ async def put(
@overload
async def put(
- self, scope: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, scope: str, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -156,25 +151,21 @@ async def put(
@distributed_trace_async
async def put(
- self, scope: str, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, scope: str, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -199,22 +190,20 @@ async def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
scope=scope,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -224,11 +213,9 @@ async def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_operations.py
index 3d5583c15b4f..860f36dee897 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instance_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,23 +17,25 @@
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._scope_access_review_history_definition_instance_operations import (
build_generate_download_uri_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 ScopeAccessReviewHistoryDefinitionInstanceOperations:
+class ScopeAccessReviewHistoryDefinitionInstanceOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -67,12 +69,11 @@ async def generate_download_uri(
:param instance_id: The id of the access review history definition instance to generate a URI
for. Required.
:type instance_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,21 +89,19 @@ async def generate_download_uri(
)
cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None)
- request = build_generate_download_uri_request(
+ _request = build_generate_download_uri_request(
scope=scope,
history_definition_id=history_definition_id,
instance_id=instance_id,
api_version=api_version,
- template_url=self.generate_download_uri.metadata["url"],
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
@@ -112,13 +111,9 @@ async def generate_download_uri(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- generate_download_uri.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_operations.py
index b08d5b0de42e..50286321aaad 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_instances_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,21 +19,23 @@
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._scope_access_review_history_definition_instances_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]]
-class ScopeAccessReviewHistoryDefinitionInstancesOperations:
+class ScopeAccessReviewHistoryDefinitionInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, scope: str, history_definition_id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewHistoryInstance"]:
+ # pylint: disable=line-too-long
"""Get access review history definition instances by definition Id.
:param scope: The scope of the resource. Required.
:type scope: str
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryInstance or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,16 +91,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
history_definition_id=history_definition_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
@@ -109,14 +109,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("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response)
@@ -126,11 +125,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
@@ -142,7 +141,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_operations.py
index 051a192ce530..b943415263c0 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definition_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,24 +18,26 @@
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._scope_access_review_history_definition_operations import (
build_create_request,
build_delete_by_id_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 ScopeAccessReviewHistoryDefinitionOperations:
+class ScopeAccessReviewHistoryDefinitionOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -77,7 +79,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: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -88,7 +89,7 @@ async def create(
self,
scope: str,
history_definition_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -100,11 +101,10 @@ async def create(
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition 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
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -115,7 +115,7 @@ async def create(
self,
scope: str,
history_definition_id: str,
- properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewHistoryDefinition:
"""Create a scheduled or one-time Access Review History Definition.
@@ -125,19 +125,15 @@ async def create(
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition properties. Is either a
- AccessReviewHistoryDefinitionProperties type or a IO type. Required.
+ AccessReviewHistoryDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -162,23 +158,21 @@ async def create(
else:
_json = self._serialize.body(properties, "AccessReviewHistoryDefinitionProperties")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
history_definition_id=history_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -188,33 +182,26 @@ async def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete_by_id( # pylint: disable=inconsistent-return-statements
- self, scope: str, history_definition_id: str, **kwargs: Any
- ) -> None:
+ async def delete_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> None:
"""Delete an access review history definition.
:param scope: The scope of the resource. Required.
:type scope: str
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: 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,
@@ -230,20 +217,18 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
scope=scope,
history_definition_id=history_definition_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -254,8 +239,4 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_operations.py
index a3756ba1f04a..737fe2aa0af0 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_history_definitions_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,25 +19,27 @@
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._scope_access_review_history_definitions_operations import (
build_get_by_id_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]]
-class ScopeAccessReviewHistoryDefinitionsOperations:
+class ScopeAccessReviewHistoryDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -61,6 +63,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewHistoryDefinition"]:
+ # pylint: disable=line-too-long
"""Lists the accessReviewHistoryDefinitions available from this provider, definition instances are
only available for 30 days after creation.
@@ -69,7 +72,6 @@ def list(
:param filter: The filter to apply on the operation. Only standard filters on definition name
and created date are supported. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryDefinition or the result of
cls(response)
:rtype:
@@ -84,7 +86,7 @@ def list(
)
cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,16 +97,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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("AccessReviewHistoryDefinitionListResult", 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
@@ -149,8 +148,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"}
-
@distributed_trace_async
async def get_by_id(
self, scope: str, history_definition_id: str, **kwargs: Any
@@ -161,12 +158,11 @@ async def get_by_id(
:type scope: str
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -182,20 +178,18 @@ async def get_by_id(
)
cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
scope=scope,
history_definition_id=history_definition_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -205,13 +199,9 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_operations.py
index 633523af6d35..d38d89054d3f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_contacted_reviewers_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,21 +19,23 @@
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._scope_access_review_instance_contacted_reviewers_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]]
-class ScopeAccessReviewInstanceContactedReviewersOperations:
+class ScopeAccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param scope: The scope of the resource. Required.
@@ -65,7 +68,6 @@ def list(
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -80,7 +82,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -91,17 +93,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=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
@@ -112,14 +112,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("AccessReviewContactedReviewerListResult", pipeline_response)
@@ -129,11 +128,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
@@ -145,7 +144,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_operations.py
index be677521f8c8..bd4dc20b2a6d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_decisions_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,21 +19,23 @@
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._scope_access_review_instance_decisions_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]]
-class ScopeAccessReviewInstanceDecisionsOperations:
+class ScopeAccessReviewInstanceDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, scope: str, schedule_definition_id: str, id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewDecision"]:
+ # pylint: disable=line-too-long
"""Get access review instance decisions.
:param scope: The scope of the resource. Required.
@@ -70,7 +73,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -85,7 +87,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -96,18 +98,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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
@@ -118,14 +118,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("AccessReviewDecisionListResult", pipeline_response)
@@ -135,11 +134,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
@@ -151,7 +150,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_operations.py
index 69703cba78d3..72cf99ee2a64 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instance_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,14 +18,12 @@
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._scope_access_review_instance_operations import (
build_apply_decisions_request,
build_record_all_decisions_request,
@@ -34,6 +32,10 @@
build_stop_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]]
@@ -59,9 +61,7 @@ def __init__(self, *args, **kwargs) -> None:
self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to stop an access review instance.
:param scope: The scope of the resource. Required.
@@ -70,12 +70,11 @@ async def stop( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -91,21 +90,19 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -116,14 +113,10 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
- async def record_all_decisions( # pylint: disable=inconsistent-return-statements
+ async def record_all_decisions(
self,
scope: str,
schedule_definition_id: str,
@@ -147,19 +140,18 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: 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:
"""
@overload
- async def record_all_decisions( # pylint: disable=inconsistent-return-statements
+ async def record_all_decisions(
self,
scope: str,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -173,23 +165,22 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Record all decisions payload. 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
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
- async def record_all_decisions( # pylint: disable=inconsistent-return-statements
+ async def record_all_decisions(
self,
scope: str,
schedule_definition_id: str,
id: str,
- properties: Union[_models.RecordAllDecisionsProperties, IO],
+ properties: Union[_models.RecordAllDecisionsProperties, IO[bytes]],
**kwargs: Any
) -> None:
"""An action to approve/deny all decisions for a review with certain filters.
@@ -201,18 +192,14 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Record all decisions payload. Is either a RecordAllDecisionsProperties type
- or a IO type. Required.
+ or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.RecordAllDecisionsProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.RecordAllDecisionsProperties or IO[bytes]
: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,
@@ -237,7 +224,7 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement
else:
_json = self._serialize.body(properties, "RecordAllDecisionsProperties")
- request = build_record_all_decisions_request(
+ _request = build_record_all_decisions_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
@@ -245,16 +232,14 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement
content_type=content_type,
json=_json,
content=_content,
- template_url=self.record_all_decisions.metadata["url"],
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
@@ -265,16 +250,10 @@ async def record_all_decisions( # pylint: disable=inconsistent-return-statement
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- record_all_decisions.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def reset_decisions( # pylint: disable=inconsistent-return-statements
- self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def reset_decisions(self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to reset all decisions for an access review instance.
:param scope: The scope of the resource. Required.
@@ -283,12 +262,11 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -304,21 +282,19 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -329,16 +305,10 @@ async def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def apply_decisions( # pylint: disable=inconsistent-return-statements
- self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def apply_decisions(self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to apply all decisions for an access review instance.
:param scope: The scope of the resource. Required.
@@ -347,12 +317,11 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -368,21 +337,19 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -393,16 +360,10 @@ async def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def send_reminders( # pylint: disable=inconsistent-return-statements
- self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
- ) -> None:
+ async def send_reminders(self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any) -> None:
"""An action to send reminders for an access review instance.
:param scope: The scope of the resource. Required.
@@ -411,12 +372,11 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -432,21 +392,19 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -457,8 +415,4 @@ async def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_operations.py
index 098e7b1ea1af..00abe2b61be8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_instances_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,21 +20,23 @@
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._scope_access_review_instances_operations import (
build_create_request,
build_get_by_id_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 __init__(self, *args, **kwargs) -> None:
def list(
self, scope: str, schedule_definition_id: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewInstance"]:
+ # pylint: disable=line-too-long
"""Get access review instances.
:param scope: The scope of the resource. Required.
@@ -74,7 +77,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -89,7 +91,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,17 +102,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
filter=filter,
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 +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
async def extract_data(pipeline_response):
deserialized = self._deserialize("AccessReviewInstanceListResult", pipeline_response)
@@ -138,11 +137,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
@@ -155,10 +154,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace_async
async def get_by_id(
self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
@@ -171,12 +166,11 @@ async def get_by_id(
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -192,21 +186,19 @@ async def get_by_id(
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -216,16 +208,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
@overload
async def create(
@@ -252,7 +240,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: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -264,7 +251,7 @@ async def create(
scope: str,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -278,11 +265,10 @@ async def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance 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
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -294,7 +280,7 @@ async def create(
scope: str,
schedule_definition_id: str,
id: str,
- properties: Union[_models.AccessReviewInstanceProperties, IO],
+ properties: Union[_models.AccessReviewInstanceProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewInstance:
"""Update access review instance.
@@ -306,18 +292,15 @@ async def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance properties. Is either a
- AccessReviewInstanceProperties type or a IO type. Required.
+ AccessReviewInstanceProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or
+ IO[bytes]
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -342,7 +325,7 @@ async def create(
else:
_json = self._serialize.body(properties, "AccessReviewInstanceProperties")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
@@ -350,16 +333,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
@@ -369,13 +350,9 @@ async def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_operations.py
index dd70ad66685a..222cb23207d1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_scope_access_review_schedule_definitions_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._scope_access_review_schedule_definitions_operations import (
build_create_or_update_by_id_request,
build_delete_by_id_request,
@@ -37,11 +35,15 @@
build_stop_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 ScopeAccessReviewScheduleDefinitionsOperations:
+class ScopeAccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -65,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param scope: The scope of the resource. Required.
@@ -74,7 +77,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -89,7 +91,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,16 +102,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -120,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
async def extract_data(pipeline_response):
deserialized = self._deserialize("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -137,11 +136,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
@@ -154,8 +153,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
-
@distributed_trace_async
async def get_by_id(
self, scope: str, schedule_definition_id: str, **kwargs: Any
@@ -166,12 +163,11 @@ async def get_by_id(
:type scope: str
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,20 +183,18 @@ async def get_by_id(
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -210,33 +204,26 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def delete_by_id( # pylint: disable=inconsistent-return-statements
- self, scope: str, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def delete_by_id(self, scope: str, schedule_definition_id: str, **kwargs: Any) -> None:
"""Delete access review schedule definition.
:param scope: The scope of the resource. Required.
:type scope: str
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -252,20 +239,18 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -276,11 +261,7 @@ async def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def create_or_update_by_id(
@@ -304,7 +285,6 @@ async def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -315,7 +295,7 @@ async def create_or_update_by_id(
self,
scope: str,
schedule_definition_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -327,11 +307,10 @@ async def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -342,7 +321,7 @@ async def create_or_update_by_id(
self,
scope: str,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -352,19 +331,15 @@ async def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -389,23 +364,21 @@ async def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -415,33 +388,26 @@ async def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
- async def stop( # pylint: disable=inconsistent-return-statements
- self, scope: str, schedule_definition_id: str, **kwargs: Any
- ) -> None:
+ async def stop(self, scope: str, schedule_definition_id: str, **kwargs: Any) -> None:
"""Stop access review definition.
:param scope: The scope of the resource. Required.
:type scope: str
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -457,20 +423,18 @@ async def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -481,8 +445,4 @@ async def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
index 9d63f1c79913..5761b8c3a1c3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/aio/operations/_tenant_level_access_review_instance_contacted_reviewers_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,21 +19,23 @@
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._tenant_level_access_review_instance_contacted_reviewers_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]]
-class TenantLevelAccessReviewInstanceContactedReviewersOperations:
+class TenantLevelAccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -57,13 +59,13 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> AsyncIterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -78,7 +80,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,16 +91,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=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
@@ -109,14 +109,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("AccessReviewContactedReviewerListResult", pipeline_response)
@@ -126,11 +125,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
@@ -142,7 +141,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py
index 4caea33af975..bd96a4b6444c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/__init__.py
@@ -5,62 +5,73 @@
# 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 AccessReviewContactedReviewer
-from ._models_py3 import AccessReviewContactedReviewerListResult
-from ._models_py3 import AccessReviewDecision
-from ._models_py3 import AccessReviewDecisionIdentity
-from ._models_py3 import AccessReviewDecisionInsight
-from ._models_py3 import AccessReviewDecisionInsightProperties
-from ._models_py3 import AccessReviewDecisionListResult
-from ._models_py3 import AccessReviewDecisionProperties
-from ._models_py3 import AccessReviewDecisionServicePrincipalIdentity
-from ._models_py3 import AccessReviewDecisionUserIdentity
-from ._models_py3 import AccessReviewDecisionUserSignInInsightProperties
-from ._models_py3 import AccessReviewDefaultSettings
-from ._models_py3 import AccessReviewHistoryDefinition
-from ._models_py3 import AccessReviewHistoryDefinitionInstanceListResult
-from ._models_py3 import AccessReviewHistoryDefinitionListResult
-from ._models_py3 import AccessReviewHistoryDefinitionProperties
-from ._models_py3 import AccessReviewHistoryInstance
-from ._models_py3 import AccessReviewInstance
-from ._models_py3 import AccessReviewInstanceListResult
-from ._models_py3 import AccessReviewInstanceProperties
-from ._models_py3 import AccessReviewReviewer
-from ._models_py3 import AccessReviewScheduleDefinition
-from ._models_py3 import AccessReviewScheduleDefinitionListResult
-from ._models_py3 import AccessReviewScheduleDefinitionProperties
-from ._models_py3 import AccessReviewScheduleSettings
-from ._models_py3 import AccessReviewScope
-from ._models_py3 import ErrorDefinition
-from ._models_py3 import ErrorDefinitionProperties
-from ._models_py3 import Operation
-from ._models_py3 import OperationDisplay
-from ._models_py3 import OperationListResult
-from ._models_py3 import RecordAllDecisionsProperties
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import AccessRecommendationType
-from ._authorization_management_client_enums import AccessReviewActorIdentityType
-from ._authorization_management_client_enums import AccessReviewApplyResult
-from ._authorization_management_client_enums import AccessReviewDecisionInsightType
-from ._authorization_management_client_enums import AccessReviewDecisionPrincipalResourceMembershipType
-from ._authorization_management_client_enums import AccessReviewHistoryDefinitionStatus
-from ._authorization_management_client_enums import AccessReviewInstanceReviewersType
-from ._authorization_management_client_enums import AccessReviewInstanceStatus
-from ._authorization_management_client_enums import AccessReviewRecurrencePatternType
-from ._authorization_management_client_enums import AccessReviewRecurrenceRangeType
-from ._authorization_management_client_enums import AccessReviewResult
-from ._authorization_management_client_enums import AccessReviewReviewerType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionReviewersType
-from ._authorization_management_client_enums import AccessReviewScheduleDefinitionStatus
-from ._authorization_management_client_enums import AccessReviewScopeAssignmentState
-from ._authorization_management_client_enums import AccessReviewScopePrincipalType
-from ._authorization_management_client_enums import DecisionResourceType
-from ._authorization_management_client_enums import DecisionTargetType
-from ._authorization_management_client_enums import DefaultDecisionType
-from ._authorization_management_client_enums import RecordAllDecisionsResult
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessReviewContactedReviewer,
+ AccessReviewContactedReviewerListResult,
+ AccessReviewDecision,
+ AccessReviewDecisionIdentity,
+ AccessReviewDecisionInsight,
+ AccessReviewDecisionInsightProperties,
+ AccessReviewDecisionListResult,
+ AccessReviewDecisionProperties,
+ AccessReviewDecisionServicePrincipalIdentity,
+ AccessReviewDecisionUserIdentity,
+ AccessReviewDecisionUserSignInInsightProperties,
+ AccessReviewDefaultSettings,
+ AccessReviewHistoryDefinition,
+ AccessReviewHistoryDefinitionInstanceListResult,
+ AccessReviewHistoryDefinitionListResult,
+ AccessReviewHistoryDefinitionProperties,
+ AccessReviewHistoryInstance,
+ AccessReviewInstance,
+ AccessReviewInstanceListResult,
+ AccessReviewInstanceProperties,
+ AccessReviewReviewer,
+ AccessReviewScheduleDefinition,
+ AccessReviewScheduleDefinitionListResult,
+ AccessReviewScheduleDefinitionProperties,
+ AccessReviewScheduleSettings,
+ AccessReviewScope,
+ ErrorDefinition,
+ ErrorDefinitionProperties,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ RecordAllDecisionsProperties,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ AccessRecommendationType,
+ AccessReviewActorIdentityType,
+ AccessReviewApplyResult,
+ AccessReviewDecisionInsightType,
+ AccessReviewDecisionPrincipalResourceMembershipType,
+ AccessReviewHistoryDefinitionStatus,
+ AccessReviewInstanceReviewersType,
+ AccessReviewInstanceStatus,
+ AccessReviewRecurrencePatternType,
+ AccessReviewRecurrenceRangeType,
+ AccessReviewResult,
+ AccessReviewReviewerType,
+ AccessReviewScheduleDefinitionReviewersType,
+ AccessReviewScheduleDefinitionStatus,
+ AccessReviewScopeAssignmentState,
+ AccessReviewScopePrincipalType,
+ DecisionResourceType,
+ DecisionTargetType,
+ DefaultDecisionType,
+ RecordAllDecisionsResult,
+)
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__ = [
@@ -117,5 +128,5 @@
"DefaultDecisionType",
"RecordAllDecisionsResult",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/_models_py3.py
index edfeb65e9e61..62ce14387853 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_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.
@@ -13,7 +13,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -99,7 +98,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewDecision(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecision(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -315,7 +314,7 @@ class AccessReviewDecisionIdentity(_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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -404,7 +403,7 @@ class AccessReviewDecisionInsightProperties(_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 type: The type of insight. Required. "userSignInInsight"
:vartype type: str or
@@ -465,7 +464,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewDecisionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDecisionProperties(_serialization.Model):
"""Approval Step.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -638,12 +637,12 @@ def __init__(
self.display_name_principal_display_name = None
-class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity):
+class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity): # pylint: disable=name-too-long
"""Service Principal Decision Target.
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -682,7 +681,7 @@ class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity):
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 type: The type of decision target : User/ServicePrincipal. Required. Known values are:
"user" and "servicePrincipal".
@@ -716,12 +715,14 @@ def __init__(self, **kwargs: Any) -> None:
self.user_principal_name = None
-class AccessReviewDecisionUserSignInInsightProperties(AccessReviewDecisionInsightProperties):
+class AccessReviewDecisionUserSignInInsightProperties(
+ AccessReviewDecisionInsightProperties
+): # pylint: disable=name-too-long
"""User Decision Target.
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 type: The type of insight. Required. "userSignInInsight"
:vartype type: str or
@@ -751,7 +752,7 @@ def __init__(self, **kwargs: Any) -> None:
self.last_sign_in_date_time = None
-class AccessReviewDefaultSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewDefaultSettings(_serialization.Model):
"""Access Review Default Settings.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -942,7 +943,7 @@ def __init__(
self.interval = interval
-class AccessReviewHistoryDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewHistoryDefinition(_serialization.Model):
"""Access Review History Definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1125,7 +1126,7 @@ def __init__(
self.user_principal_name = None
-class AccessReviewHistoryDefinitionInstanceListResult(_serialization.Model):
+class AccessReviewHistoryDefinitionInstanceListResult(_serialization.Model): # pylint: disable=name-too-long
"""List of Access Review History Instances.
:ivar value: Access Review History Definition's Instance list.
@@ -1193,7 +1194,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewHistoryDefinitionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewHistoryDefinitionProperties(_serialization.Model):
"""Access Review History Instances.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1358,7 +1359,7 @@ def __init__(
self.user_principal_name = None
-class AccessReviewHistoryInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewHistoryInstance(_serialization.Model):
"""Access Review History Definition Instance.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1692,7 +1693,7 @@ def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None
self.principal_type = None
-class AccessReviewScheduleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinition(_serialization.Model):
"""Access Review Schedule Definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2104,7 +2105,7 @@ def __init__(
self.next_link = next_link
-class AccessReviewScheduleDefinitionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleDefinitionProperties(_serialization.Model):
"""Access Review.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2447,7 +2448,7 @@ def __init__( # pylint: disable=too-many-locals
self.user_principal_name = None
-class AccessReviewScheduleSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AccessReviewScheduleSettings(_serialization.Model):
"""Settings of an Access Review.
:ivar mail_notifications_enabled: Flag to indicate whether sending mails to reviewers and the
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py
index d04d147885dc..37b69755bdf5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/__init__.py
@@ -5,47 +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 ._operations import Operations
-from ._access_review_history_definitions_operations import AccessReviewHistoryDefinitionsOperations
-from ._access_review_history_definition_operations import AccessReviewHistoryDefinitionOperations
-from ._access_review_history_definition_instance_operations import AccessReviewHistoryDefinitionInstanceOperations
-from ._access_review_history_definition_instances_operations import AccessReviewHistoryDefinitionInstancesOperations
-from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations
-from ._access_review_instances_operations import AccessReviewInstancesOperations
-from ._access_review_instance_operations import AccessReviewInstanceOperations
-from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations
-from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations
-from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations
-from ._scope_access_review_history_definitions_operations import ScopeAccessReviewHistoryDefinitionsOperations
-from ._scope_access_review_history_definition_operations import ScopeAccessReviewHistoryDefinitionOperations
-from ._scope_access_review_history_definition_instance_operations import (
- ScopeAccessReviewHistoryDefinitionInstanceOperations,
-)
-from ._scope_access_review_history_definition_instances_operations import (
- ScopeAccessReviewHistoryDefinitionInstancesOperations,
-)
-from ._scope_access_review_schedule_definitions_operations import ScopeAccessReviewScheduleDefinitionsOperations
-from ._scope_access_review_instances_operations import ScopeAccessReviewInstancesOperations
-from ._scope_access_review_instance_operations import ScopeAccessReviewInstanceOperations
-from ._scope_access_review_instance_decisions_operations import ScopeAccessReviewInstanceDecisionsOperations
-from ._scope_access_review_instance_contacted_reviewers_operations import (
- ScopeAccessReviewInstanceContactedReviewersOperations,
-)
-from ._scope_access_review_default_settings_operations import ScopeAccessReviewDefaultSettingsOperations
-from ._access_review_schedule_definitions_assigned_for_my_approval_operations import (
- AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations,
-)
-from ._access_review_instances_assigned_for_my_approval_operations import (
- AccessReviewInstancesAssignedForMyApprovalOperations,
-)
-from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations
-from ._tenant_level_access_review_instance_contacted_reviewers_operations import (
- TenantLevelAccessReviewInstanceContactedReviewersOperations,
-)
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._access_review_history_definitions_operations import AccessReviewHistoryDefinitionsOperations # type: ignore
+from ._access_review_history_definition_operations import AccessReviewHistoryDefinitionOperations # type: ignore
+from ._access_review_history_definition_instance_operations import AccessReviewHistoryDefinitionInstanceOperations # type: ignore
+from ._access_review_history_definition_instances_operations import AccessReviewHistoryDefinitionInstancesOperations # type: ignore
+from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations # type: ignore
+from ._access_review_instances_operations import AccessReviewInstancesOperations # type: ignore
+from ._access_review_instance_operations import AccessReviewInstanceOperations # type: ignore
+from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations # type: ignore
+from ._access_review_instance_contacted_reviewers_operations import AccessReviewInstanceContactedReviewersOperations # type: ignore
+from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations # type: ignore
+from ._scope_access_review_history_definitions_operations import ScopeAccessReviewHistoryDefinitionsOperations # type: ignore
+from ._scope_access_review_history_definition_operations import ScopeAccessReviewHistoryDefinitionOperations # type: ignore
+from ._scope_access_review_history_definition_instance_operations import ScopeAccessReviewHistoryDefinitionInstanceOperations # type: ignore
+from ._scope_access_review_history_definition_instances_operations import ScopeAccessReviewHistoryDefinitionInstancesOperations # type: ignore
+from ._scope_access_review_schedule_definitions_operations import ScopeAccessReviewScheduleDefinitionsOperations # type: ignore
+from ._scope_access_review_instances_operations import ScopeAccessReviewInstancesOperations # type: ignore
+from ._scope_access_review_instance_operations import ScopeAccessReviewInstanceOperations # type: ignore
+from ._scope_access_review_instance_decisions_operations import ScopeAccessReviewInstanceDecisionsOperations # type: ignore
+from ._scope_access_review_instance_contacted_reviewers_operations import ScopeAccessReviewInstanceContactedReviewersOperations # type: ignore
+from ._scope_access_review_default_settings_operations import ScopeAccessReviewDefaultSettingsOperations # type: ignore
+from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations # type: ignore
+from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations # type: ignore
+from ._tenant_level_access_review_instance_contacted_reviewers_operations import TenantLevelAccessReviewInstanceContactedReviewersOperations # 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__ = [
@@ -75,5 +69,5 @@
"AccessReviewInstanceMyDecisionsOperations",
"TenantLevelAccessReviewInstanceContactedReviewersOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py
index 635c42dbc02c..f8118a69410f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -116,12 +118,11 @@ def __init__(self, *args, **kwargs):
def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,19 +138,17 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
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
@@ -159,16 +158,12 @@ def get(self, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", 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}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
@overload
def put(
@@ -182,7 +177,6 @@ def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -190,16 +184,15 @@ def put(
@overload
def put(
- self, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -207,23 +200,19 @@ def put(
@distributed_trace
def put(
- self, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,22 +237,20 @@ def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -273,13 +260,9 @@ def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- put.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py
index 431dba43d577..3b0ba74aa0a3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_generate_download_uri_request(
"instanceId": _SERIALIZER.url("instance_id", instance_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -65,7 +67,7 @@ def build_generate_download_uri_request(
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewHistoryDefinitionInstanceOperations:
+class AccessReviewHistoryDefinitionInstanceOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -97,12 +99,11 @@ def generate_download_uri(
:param instance_id: The id of the access review history definition instance to generate a URI
for. Required.
:type instance_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -118,21 +119,19 @@ def generate_download_uri(
)
cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None)
- request = build_generate_download_uri_request(
+ _request = build_generate_download_uri_request(
history_definition_id=history_definition_id,
instance_id=instance_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.generate_download_uri.metadata["url"],
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
@@ -142,13 +141,9 @@ def generate_download_uri(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- generate_download_uri.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py
index e3bc81edcfea..28ca7b9da78b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(history_definition_id: str, subscription_id: str, **kwarg
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -64,7 +66,7 @@ def build_list_request(history_definition_id: str, subscription_id: str, **kwarg
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewHistoryDefinitionInstancesOperations:
+class AccessReviewHistoryDefinitionInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -90,7 +92,6 @@ def list(self, history_definition_id: str, **kwargs: Any) -> Iterable["_models.A
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryInstance or the result of
cls(response)
:rtype:
@@ -105,7 +106,7 @@ def list(self, history_definition_id: str, **kwargs: Any) -> Iterable["_models.A
)
cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -116,16 +117,14 @@ def list(self, history_definition_id: str, **kwargs: Any) -> Iterable["_models.A
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
history_definition_id=history_definition_id,
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
@@ -136,14 +135,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("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response)
@@ -153,11 +151,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
@@ -169,7 +167,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py
index 696f778cdd14..14ed13846b43 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_create_request(history_definition_id: str, subscription_id: str, **kwa
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_delete_by_id_request(history_definition_id: str, subscription_id: str,
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -133,7 +135,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: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -141,18 +142,22 @@ def create(
@overload
def create(
- self, history_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ history_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewHistoryDefinition:
"""Create a scheduled or one-time Access Review History Definition.
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition 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
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -162,7 +167,7 @@ def create(
def create(
self,
history_definition_id: str,
- properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewHistoryDefinition:
"""Create a scheduled or one-time Access Review History Definition.
@@ -170,19 +175,15 @@ def create(
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition properties. Is either a
- AccessReviewHistoryDefinitionProperties type or a IO type. Required.
+ AccessReviewHistoryDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -207,23 +208,21 @@ def create(
else:
_json = self._serialize.body(properties, "AccessReviewHistoryDefinitionProperties")
- request = build_create_request(
+ _request = build_create_request(
history_definition_id=history_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -233,16 +232,12 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", 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}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id( # pylint: disable=inconsistent-return-statements
@@ -252,12 +247,11 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: 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,
@@ -273,20 +267,18 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
history_definition_id=history_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -297,8 +289,4 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py
index 031558519eec..53d8d513606c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -82,7 +84,7 @@ def build_get_by_id_request(history_definition_id: str, subscription_id: str, **
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -115,13 +117,13 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AccessReviewHistoryDefinition"]:
+ # pylint: disable=line-too-long
"""Lists the accessReviewHistoryDefinitions available from this provider, definition instances are
only available for 30 days after creation.
:param filter: The filter to apply on the operation. Only standard filters on definition name
and created date are supported. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryDefinition or the result of
cls(response)
:rtype:
@@ -136,7 +138,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -147,16 +149,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -167,14 +167,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("AccessReviewHistoryDefinitionListResult", pipeline_response)
@@ -184,11 +183,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
@@ -201,22 +200,17 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"
- }
-
@distributed_trace
def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.AccessReviewHistoryDefinition:
"""Get access review history definition by definition Id.
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -232,20 +226,18 @@ def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.Access
)
cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
history_definition_id=history_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -255,13 +247,9 @@ def get_by_id(self, history_definition_id: str, **kwargs: Any) -> _models.Access
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py
index f26b7dd35419..3deca233391e 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -65,7 +67,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstanceContactedReviewersOperations:
+class AccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -89,13 +91,13 @@ def __init__(self, *args, **kwargs):
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> Iterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -110,7 +112,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = 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(
schedule_definition_id=schedule_definition_id,
id=id,
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("AccessReviewContactedReviewerListResult", 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.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py
index fe0a8f1c6f7b..b636ad6db849 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -104,7 +106,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -119,7 +120,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,18 +131,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -152,14 +151,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("AccessReviewDecisionListResult", pipeline_response)
@@ -169,11 +167,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
@@ -185,7 +183,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py
index 525e2d35e491..a1a366dcc33a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,7 +119,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
"decisionId": _SERIALIZER.url("decision_id", decision_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -130,7 +132,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str,
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstanceMyDecisionsOperations:
+class AccessReviewInstanceMyDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -165,7 +167,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -180,7 +181,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,17 +192,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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("AccessReviewDecisionListResult", 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": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
-
@distributed_trace
def get_by_id(
self, schedule_definition_id: str, id: str, decision_id: str, **kwargs: Any
@@ -262,12 +256,11 @@ def get_by_id(
:type id: str
:param decision_id: The id of the decision record. Required.
:type decision_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -283,21 +276,19 @@ def get_by_id(
)
cls: ClsType[_models.AccessReviewDecision] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -307,16 +298,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
@overload
def patch(
@@ -343,7 +330,6 @@ def patch(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -355,7 +341,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -369,11 +355,10 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. 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
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
@@ -385,7 +370,7 @@ def patch(
schedule_definition_id: str,
id: str,
decision_id: str,
- properties: Union[_models.AccessReviewDecisionProperties, IO],
+ properties: Union[_models.AccessReviewDecisionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewDecision:
"""Record a decision.
@@ -397,18 +382,15 @@ def patch(
:param decision_id: The id of the decision record. Required.
:type decision_id: str
:param properties: Access review decision properties to patch. Is either a
- AccessReviewDecisionProperties type or a IO type. Required.
+ AccessReviewDecisionProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecisionProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewDecisionProperties or
+ IO[bytes]
:return: AccessReviewDecision or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDecision
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +415,7 @@ def patch(
else:
_json = self._serialize.body(properties, "AccessReviewDecisionProperties")
- request = build_patch_request(
+ _request = build_patch_request(
schedule_definition_id=schedule_definition_id,
id=id,
decision_id=decision_id,
@@ -441,16 +423,14 @@ def patch(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.patch.metadata["url"],
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
@@ -460,13 +440,9 @@ def patch(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDecision", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDecision", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- patch.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py
index 6480468e873e..7ab10515bacd 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_reset_decisions_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -114,7 +116,7 @@ def build_apply_decisions_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -145,7 +147,7 @@ def build_send_reminders_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -173,7 +175,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, *
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -214,12 +216,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -235,21 +236,19 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -260,11 +259,7 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def reset_decisions( # pylint: disable=inconsistent-return-statements
@@ -276,12 +271,11 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -297,21 +291,19 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -322,11 +314,7 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def apply_decisions( # pylint: disable=inconsistent-return-statements
@@ -338,12 +326,11 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -359,21 +346,19 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -384,11 +369,7 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def send_reminders( # pylint: disable=inconsistent-return-statements
@@ -400,12 +381,11 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -421,21 +401,19 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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
@@ -446,11 +424,7 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def accept_recommendations( # pylint: disable=inconsistent-return-statements
@@ -462,12 +436,11 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -483,20 +456,18 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_accept_recommendations_request(
+ _request = build_accept_recommendations_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.accept_recommendations.metadata["url"],
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
@@ -507,8 +478,4 @@ def accept_recommendations( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- accept_recommendations.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
index 490c4997b6fd..3c4dd06061f6 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -82,7 +84,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -93,7 +95,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any)
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewInstancesAssignedForMyApprovalOperations:
+class AccessReviewInstancesAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -126,7 +128,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -141,7 +142,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -152,16 +153,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
filter=filter,
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
@@ -172,14 +171,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("AccessReviewInstanceListResult", pipeline_response)
@@ -189,11 +187,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
@@ -206,10 +204,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get single access review instance assigned for my approval.
@@ -218,12 +212,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -239,20 +232,18 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -262,13 +253,9 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py
index 980b5e96f2d8..4d08964fcfc5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,7 +119,7 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id:
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -163,7 +165,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -178,7 +179,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -189,17 +190,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -210,14 +209,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("AccessReviewInstanceListResult", pipeline_response)
@@ -227,11 +225,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
@@ -244,10 +242,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _models.AccessReviewInstance:
"""Get access review instances.
@@ -256,12 +250,11 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -277,21 +270,19 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -301,16 +292,12 @@ def get_by_id(self, schedule_definition_id: str, id: str, **kwargs: Any) -> _mod
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
@overload
def create(
@@ -334,7 +321,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: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -345,7 +331,7 @@ def create(
self,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -357,11 +343,10 @@ def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance 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
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -372,7 +357,7 @@ def create(
self,
schedule_definition_id: str,
id: str,
- properties: Union[_models.AccessReviewInstanceProperties, IO],
+ properties: Union[_models.AccessReviewInstanceProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewInstance:
"""Update access review instance.
@@ -382,18 +367,15 @@ def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance properties. Is either a
- AccessReviewInstanceProperties type or a IO type. Required.
+ AccessReviewInstanceProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or
+ IO[bytes]
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,7 +400,7 @@ def create(
else:
_json = self._serialize.body(properties, "AccessReviewInstanceProperties")
- request = build_create_request(
+ _request = build_create_request(
schedule_definition_id=schedule_definition_id,
id=id,
subscription_id=self._config.subscription_id,
@@ -426,16 +408,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
@@ -445,13 +425,9 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", 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}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
index 184634f92127..37cbfa904e14 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_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]]
@@ -57,7 +59,7 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations:
+class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -79,6 +81,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review instances assigned for my approval.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -86,7 +89,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -101,7 +103,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -112,15 +114,13 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
filter=filter,
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
@@ -131,14 +131,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -148,11 +147,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
@@ -164,5 +163,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py
index 174c294924f2..4e1a6335c259 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, *
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -111,7 +113,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,7 +144,7 @@ def build_create_or_update_by_id_request(
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -172,7 +174,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -183,7 +185,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class AccessReviewScheduleDefinitionsOperations:
+class AccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -205,6 +207,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param filter: The filter to apply on the operation. Other than standard filters, one custom
@@ -212,7 +215,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -227,7 +229,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -238,16 +240,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -258,14 +258,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -275,11 +274,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
@@ -292,22 +291,17 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"
- }
-
@distributed_trace
def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.AccessReviewScheduleDefinition:
"""Get single access review definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -323,20 +317,18 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -346,16 +338,12 @@ def get_by_id(self, schedule_definition_id: str, **kwargs: Any) -> _models.Acces
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id( # pylint: disable=inconsistent-return-statements
@@ -365,12 +353,11 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -386,20 +373,18 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -410,11 +395,7 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def create_or_update_by_id(
@@ -435,7 +416,6 @@ def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -443,18 +423,22 @@ def create_or_update_by_id(
@overload
def create_or_update_by_id(
- self, schedule_definition_id: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self,
+ schedule_definition_id: str,
+ properties: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -464,7 +448,7 @@ def create_or_update_by_id(
def create_or_update_by_id(
self,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -472,19 +456,15 @@ def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -509,23 +489,21 @@ def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -535,16 +513,12 @@ def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- create_or_update_by_id.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def stop( # pylint: disable=inconsistent-return-statements
@@ -554,12 +528,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -575,20 +548,18 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
schedule_definition_id=schedule_definition_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -599,8 +570,4 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_operations.py
index 5153ed8f2e57..9251432a4af1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_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]]
@@ -79,7 +81,6 @@ def __init__(self, *args, **kwargs):
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists the operations available from this provider.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2021_12_01_preview.models.Operation]
@@ -93,7 +94,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
)
cls: ClsType[_models.OperationListResult] = 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.Operation"]:
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("OperationListResult", 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.Authorization/operations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py
index 42207206696a..c587c3201aff 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -48,7 +50,7 @@ def build_get_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -73,7 +75,7 @@ def build_put_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +88,7 @@ def build_put_request(scope: str, **kwargs: Any) -> HttpRequest:
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewDefaultSettingsOperations:
+class ScopeAccessReviewDefaultSettingsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -112,12 +114,11 @@ def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
:param scope: The scope of the resource. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -133,19 +134,17 @@ def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
)
cls: ClsType[_models.AccessReviewDefaultSettings] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
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
@@ -155,14 +154,12 @@ def get(self, scope: str, **kwargs: Any) -> _models.AccessReviewDefaultSettings:
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"}
+ return deserialized # type: ignore
@overload
def put(
@@ -183,7 +180,6 @@ def put(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -191,18 +187,17 @@ def put(
@overload
def put(
- self, scope: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, scope: str, properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Access review schedule settings. 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
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
@@ -210,25 +205,21 @@ def put(
@distributed_trace
def put(
- self, scope: str, properties: Union[_models.AccessReviewScheduleSettings, IO], **kwargs: Any
+ self, scope: str, properties: Union[_models.AccessReviewScheduleSettings, IO[bytes]], **kwargs: Any
) -> _models.AccessReviewDefaultSettings:
"""Get access review default settings for the subscription.
:param scope: The scope of the resource. Required.
:type scope: str
:param properties: Access review schedule settings. Is either a AccessReviewScheduleSettings
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewScheduleSettings or IO[bytes]
:return: AccessReviewDefaultSettings or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewDefaultSettings
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,22 +244,20 @@ def put(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleSettings")
- request = build_put_request(
+ _request = build_put_request(
scope=scope,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.put.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -278,11 +267,9 @@ def put(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response)
+ deserialized = self._deserialize("AccessReviewDefaultSettings", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- put.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py
index b87d3afdef57..8e3693f4b2dc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_generate_download_uri_request(
"instanceId": _SERIALIZER.url("instance_id", instance_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -65,7 +67,7 @@ def build_generate_download_uri_request(
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewHistoryDefinitionInstanceOperations:
+class ScopeAccessReviewHistoryDefinitionInstanceOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -99,12 +101,11 @@ def generate_download_uri(
:param instance_id: The id of the access review history definition instance to generate a URI
for. Required.
:type instance_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -120,21 +121,19 @@ def generate_download_uri(
)
cls: ClsType[_models.AccessReviewHistoryInstance] = kwargs.pop("cls", None)
- request = build_generate_download_uri_request(
+ _request = build_generate_download_uri_request(
scope=scope,
history_definition_id=history_definition_id,
instance_id=instance_id,
api_version=api_version,
- template_url=self.generate_download_uri.metadata["url"],
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
@@ -144,13 +143,9 @@ def generate_download_uri(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- generate_download_uri.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py
index 04bd6281d819..8760e7a01786 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(scope: str, history_definition_id: str, **kwargs: Any) ->
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -64,7 +66,7 @@ def build_list_request(scope: str, history_definition_id: str, **kwargs: Any) ->
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewHistoryDefinitionInstancesOperations:
+class ScopeAccessReviewHistoryDefinitionInstancesOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -94,7 +96,6 @@ def list(
:type scope: str
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryInstance or the result of
cls(response)
:rtype:
@@ -109,7 +110,7 @@ def list(
)
cls: ClsType[_models.AccessReviewHistoryDefinitionInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -120,16 +121,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
history_definition_id=history_definition_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
@@ -140,14 +139,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("AccessReviewHistoryDefinitionInstanceListResult", pipeline_response)
@@ -157,11 +155,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
@@ -173,7 +171,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py
index 48311167b09c..6ed312096b29 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_create_request(scope: str, history_definition_id: str, **kwargs: Any)
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_delete_by_id_request(scope: str, history_definition_id: str, **kwargs:
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -94,7 +96,7 @@ def build_delete_by_id_request(scope: str, history_definition_id: str, **kwargs:
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewHistoryDefinitionOperations:
+class ScopeAccessReviewHistoryDefinitionOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -136,7 +138,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: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -147,7 +148,7 @@ def create(
self,
scope: str,
history_definition_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -159,11 +160,10 @@ def create(
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition 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
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -174,7 +174,7 @@ def create(
self,
scope: str,
history_definition_id: str,
- properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewHistoryDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewHistoryDefinition:
"""Create a scheduled or one-time Access Review History Definition.
@@ -184,19 +184,15 @@ def create(
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
:param properties: Access review history definition properties. Is either a
- AccessReviewHistoryDefinitionProperties type or a IO type. Required.
+ AccessReviewHistoryDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinitionProperties or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -221,23 +217,21 @@ def create(
else:
_json = self._serialize.body(properties, "AccessReviewHistoryDefinitionProperties")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
history_definition_id=history_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -247,16 +241,12 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id( # pylint: disable=inconsistent-return-statements
@@ -268,12 +258,11 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
:type scope: str
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: 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,
@@ -289,20 +278,18 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
scope=scope,
history_definition_id=history_definition_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -313,8 +300,4 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py
index 353d0b4774d0..d6283adf5111 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_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, _format_url_section
+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]]
@@ -49,7 +51,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An
"scope": _SERIALIZER.url("scope", scope, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +81,7 @@ def build_get_by_id_request(scope: str, history_definition_id: str, **kwargs: An
"historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -90,7 +92,7 @@ def build_get_by_id_request(scope: str, history_definition_id: str, **kwargs: An
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewHistoryDefinitionsOperations:
+class ScopeAccessReviewHistoryDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -114,6 +116,7 @@ def __init__(self, *args, **kwargs):
def list(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.AccessReviewHistoryDefinition"]:
+ # pylint: disable=line-too-long
"""Lists the accessReviewHistoryDefinitions available from this provider, definition instances are
only available for 30 days after creation.
@@ -122,7 +125,6 @@ def list(
:param filter: The filter to apply on the operation. Only standard filters on definition name
and created date are supported. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewHistoryDefinition or the result of
cls(response)
:rtype:
@@ -137,7 +139,7 @@ def list(
)
cls: ClsType[_models.AccessReviewHistoryDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -148,16 +150,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -168,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("AccessReviewHistoryDefinitionListResult", pipeline_response)
@@ -185,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,8 +201,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions"}
-
@distributed_trace
def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _models.AccessReviewHistoryDefinition:
"""Get access review history definition by definition Id.
@@ -212,12 +209,11 @@ def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _m
:type scope: str
:param history_definition_id: The id of the access review history definition. Required.
:type history_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewHistoryDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewHistoryDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -233,20 +229,18 @@ def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _m
)
cls: ClsType[_models.AccessReviewHistoryDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
scope=scope,
history_definition_id=history_definition_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -256,13 +250,9 @@ def get_by_id(self, scope: str, history_definition_id: str, **kwargs: Any) -> _m
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewHistoryDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py
index 1b43fcc8e090..a1fa5925c2de 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_list_request(scope: str, schedule_definition_id: str, id: str, **kwarg
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -65,7 +67,7 @@ def build_list_request(scope: str, schedule_definition_id: str, id: str, **kwarg
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewInstanceContactedReviewersOperations:
+class ScopeAccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -89,6 +91,7 @@ def __init__(self, *args, **kwargs):
def list(
self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
) -> Iterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param scope: The scope of the resource. Required.
@@ -97,7 +100,6 @@ def list(
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -112,7 +114,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -123,17 +125,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=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
@@ -144,14 +144,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("AccessReviewContactedReviewerListResult", pipeline_response)
@@ -161,11 +160,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
@@ -177,7 +176,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py
index b7fb53ea5a5d..f1344df37ed4 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -69,7 +71,7 @@ def build_list_request(
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewInstanceDecisionsOperations:
+class ScopeAccessReviewInstanceDecisionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -106,7 +108,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewDecision or the result of
cls(response)
:rtype:
@@ -121,7 +122,7 @@ def list(
)
cls: ClsType[_models.AccessReviewDecisionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -132,18 +133,16 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
filter=filter,
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
@@ -154,14 +153,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("AccessReviewDecisionListResult", pipeline_response)
@@ -171,11 +169,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
@@ -187,7 +185,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py
index 38813e0e8231..e75880c06482 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_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, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
@@ -18,16 +18,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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_stop_request(scope: str, schedule_definition_id: str, id: str, **kwarg
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -83,7 +85,7 @@ def build_record_all_decisions_request(scope: str, schedule_definition_id: str,
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -114,7 +116,7 @@ def build_reset_decisions_request(scope: str, schedule_definition_id: str, id: s
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -143,7 +145,7 @@ def build_apply_decisions_request(scope: str, schedule_definition_id: str, id: s
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -172,7 +174,7 @@ def build_send_reminders_request(scope: str, schedule_definition_id: str, id: st
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -215,12 +217,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -236,21 +237,19 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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
@@ -261,14 +260,10 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
- def record_all_decisions( # pylint: disable=inconsistent-return-statements
+ def record_all_decisions(
self,
scope: str,
schedule_definition_id: str,
@@ -292,19 +287,18 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: 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:
"""
@overload
- def record_all_decisions( # pylint: disable=inconsistent-return-statements
+ def record_all_decisions(
self,
scope: str,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -318,11 +312,10 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Record all decisions payload. 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
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -334,7 +327,7 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements
scope: str,
schedule_definition_id: str,
id: str,
- properties: Union[_models.RecordAllDecisionsProperties, IO],
+ properties: Union[_models.RecordAllDecisionsProperties, IO[bytes]],
**kwargs: Any
) -> None:
"""An action to approve/deny all decisions for a review with certain filters.
@@ -346,18 +339,14 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Record all decisions payload. Is either a RecordAllDecisionsProperties type
- or a IO type. Required.
+ or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.RecordAllDecisionsProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.RecordAllDecisionsProperties or IO[bytes]
: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,
@@ -382,7 +371,7 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements
else:
_json = self._serialize.body(properties, "RecordAllDecisionsProperties")
- request = build_record_all_decisions_request(
+ _request = build_record_all_decisions_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
@@ -390,16 +379,14 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements
content_type=content_type,
json=_json,
content=_content,
- template_url=self.record_all_decisions.metadata["url"],
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
@@ -410,11 +397,7 @@ def record_all_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- record_all_decisions.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def reset_decisions( # pylint: disable=inconsistent-return-statements
@@ -428,12 +411,11 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -449,21 +431,19 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_reset_decisions_request(
+ _request = build_reset_decisions_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.reset_decisions.metadata["url"],
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
@@ -474,11 +454,7 @@ def reset_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- reset_decisions.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def apply_decisions( # pylint: disable=inconsistent-return-statements
@@ -492,12 +468,11 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -513,21 +488,19 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_apply_decisions_request(
+ _request = build_apply_decisions_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.apply_decisions.metadata["url"],
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
@@ -538,11 +511,7 @@ def apply_decisions( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- apply_decisions.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def send_reminders( # pylint: disable=inconsistent-return-statements
@@ -556,12 +525,11 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: 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,
@@ -577,21 +545,19 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_send_reminders_request(
+ _request = build_send_reminders_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.send_reminders.metadata["url"],
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,8 +568,4 @@ def send_reminders( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- send_reminders.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py
index 260ac1c153f3..f48ca7b647ba 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_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, _format_url_section
+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]]
@@ -56,7 +58,7 @@ def build_list_request(
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -87,7 +89,7 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, id: str, **
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,7 +119,7 @@ def build_create_request(scope: str, schedule_definition_id: str, id: str, **kwa
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -165,7 +167,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewInstance or the result of
cls(response)
:rtype:
@@ -180,7 +181,7 @@ def list(
)
cls: ClsType[_models.AccessReviewInstanceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,17 +192,15 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
filter=filter,
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("AccessReviewInstanceListResult", 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": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances"
- }
-
@distributed_trace
def get_by_id(
self, scope: str, schedule_definition_id: str, id: str, **kwargs: Any
@@ -262,12 +256,11 @@ def get_by_id(
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -283,21 +276,19 @@ def get_by_id(
)
cls: ClsType[_models.AccessReviewInstance] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -307,16 +298,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
@overload
def create(
@@ -343,7 +330,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: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -355,7 +341,7 @@ def create(
scope: str,
schedule_definition_id: str,
id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -369,11 +355,10 @@ def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance 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
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
@@ -385,7 +370,7 @@ def create(
scope: str,
schedule_definition_id: str,
id: str,
- properties: Union[_models.AccessReviewInstanceProperties, IO],
+ properties: Union[_models.AccessReviewInstanceProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewInstance:
"""Update access review instance.
@@ -397,18 +382,15 @@ def create(
:param id: The id of the access review instance. Required.
:type id: str
:param properties: Access review instance properties. Is either a
- AccessReviewInstanceProperties type or a IO type. Required.
+ AccessReviewInstanceProperties type or a IO[bytes] type. Required.
:type properties:
- ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2021_12_01_preview.models.AccessReviewInstanceProperties or
+ IO[bytes]
:return: AccessReviewInstance or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewInstance
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +415,7 @@ def create(
else:
_json = self._serialize.body(properties, "AccessReviewInstanceProperties")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
id=id,
@@ -441,16 +423,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
@@ -460,13 +440,9 @@ def create(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewInstance", pipeline_response)
+ deserialized = self._deserialize("AccessReviewInstance", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py
index daf22c9b80a3..c851aa28ab2a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_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, _format_url_section
+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]]
@@ -50,7 +52,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An
"scope": _SERIALIZER.url("scope", scope, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -80,7 +82,7 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, **kwargs: A
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -108,7 +110,7 @@ def build_delete_by_id_request(scope: str, schedule_definition_id: str, **kwargs
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -137,7 +139,7 @@ def build_create_or_update_by_id_request(scope: str, schedule_definition_id: str
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -167,7 +169,7 @@ def build_stop_request(scope: str, schedule_definition_id: str, **kwargs: Any) -
"scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -178,7 +180,7 @@ def build_stop_request(scope: str, schedule_definition_id: str, **kwargs: Any) -
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class ScopeAccessReviewScheduleDefinitionsOperations:
+class ScopeAccessReviewScheduleDefinitionsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -202,6 +204,7 @@ def __init__(self, *args, **kwargs):
def list(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.AccessReviewScheduleDefinition"]:
+ # pylint: disable=line-too-long
"""Get access review schedule definitions.
:param scope: The scope of the resource. Required.
@@ -211,7 +214,6 @@ def list(
$filter=assignedToMeToReview(), only items that are assigned to the calling user to review are
returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewScheduleDefinition or the result of
cls(response)
:rtype:
@@ -226,7 +228,7 @@ def list(
)
cls: ClsType[_models.AccessReviewScheduleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -237,16 +239,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -257,14 +257,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("AccessReviewScheduleDefinitionListResult", pipeline_response)
@@ -274,11 +273,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
@@ -291,8 +290,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"}
-
@distributed_trace
def get_by_id(
self, scope: str, schedule_definition_id: str, **kwargs: Any
@@ -303,12 +300,11 @@ def get_by_id(
:type scope: str
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -324,20 +320,18 @@ def get_by_id(
)
cls: ClsType[_models.AccessReviewScheduleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -347,16 +341,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def delete_by_id( # pylint: disable=inconsistent-return-statements
@@ -368,12 +358,11 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
:type scope: str
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -389,20 +378,18 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -413,11 +400,7 @@ def delete_by_id( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- delete_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def create_or_update_by_id(
@@ -441,7 +424,6 @@ def create_or_update_by_id(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -452,7 +434,7 @@ def create_or_update_by_id(
self,
scope: str,
schedule_definition_id: str,
- properties: IO,
+ properties: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -464,11 +446,10 @@ def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition 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
:return: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -479,7 +460,7 @@ def create_or_update_by_id(
self,
scope: str,
schedule_definition_id: str,
- properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO],
+ properties: Union[_models.AccessReviewScheduleDefinitionProperties, IO[bytes]],
**kwargs: Any
) -> _models.AccessReviewScheduleDefinition:
"""Create or Update access review schedule definition.
@@ -489,19 +470,15 @@ def create_or_update_by_id(
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param properties: Access review schedule definition properties. Is either a
- AccessReviewScheduleDefinitionProperties type or a IO type. Required.
+ AccessReviewScheduleDefinitionProperties type or a IO[bytes] type. Required.
:type properties:
~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinitionProperties
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: AccessReviewScheduleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2021_12_01_preview.models.AccessReviewScheduleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -526,23 +503,21 @@ def create_or_update_by_id(
else:
_json = self._serialize.body(properties, "AccessReviewScheduleDefinitionProperties")
- request = build_create_or_update_by_id_request(
+ _request = build_create_or_update_by_id_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update_by_id.metadata["url"],
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
@@ -552,16 +527,12 @@ def create_or_update_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorDefinition, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response)
+ deserialized = self._deserialize("AccessReviewScheduleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update_by_id.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def stop( # pylint: disable=inconsistent-return-statements
@@ -573,12 +544,11 @@ def stop( # pylint: disable=inconsistent-return-statements
:type scope: str
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: 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,
@@ -594,20 +564,18 @@ def stop( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_stop_request(
+ _request = build_stop_request(
scope=scope,
schedule_definition_id=schedule_definition_id,
api_version=api_version,
- template_url=self.stop.metadata["url"],
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,8 +586,4 @@ def stop( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- stop.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
index bba1797ba26a..bf303cd54dfd 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H
"id": _SERIALIZER.url("id", id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -64,7 +66,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-class TenantLevelAccessReviewInstanceContactedReviewersOperations:
+class TenantLevelAccessReviewInstanceContactedReviewersOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -88,13 +90,13 @@ def __init__(self, *args, **kwargs):
def list(
self, schedule_definition_id: str, id: str, **kwargs: Any
) -> Iterable["_models.AccessReviewContactedReviewer"]:
+ # pylint: disable=line-too-long
"""Get access review instance contacted reviewers.
:param schedule_definition_id: The id of the access review schedule definition. Required.
:type schedule_definition_id: str
:param id: The id of the access review instance. Required.
:type id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AccessReviewContactedReviewer or the result of
cls(response)
:rtype:
@@ -109,7 +111,7 @@ def list(
)
cls: ClsType[_models.AccessReviewContactedReviewerListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -120,16 +122,14 @@ def list(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
schedule_definition_id=schedule_definition_id,
id=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
@@ -140,14 +140,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("AccessReviewContactedReviewerListResult", pipeline_response)
@@ -157,11 +156,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
@@ -173,7 +172,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {
- "url": "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py
index 048a0e100390..3a57701b9300 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to get deny
assignments. A deny assignment describes the set of actions on resources that are denied for
@@ -69,7 +71,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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-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
@@ -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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py
index b501f5692f43..40453c391c28 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-04-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json
index 1ded4f59232d..2098bac38b93 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"deny_assignments": "DenyAssignmentsOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py
index c742c42451a6..d1ebbd27d7fc 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to get deny
assignments. A deny assignment describes the set of actions on resources that are denied for
@@ -69,7 +71,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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-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
@@ -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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py
index f778747ea8b4..fbb9192252d9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-04-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py
index 336442a84fe5..8679ec8c6d15 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/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 ._deny_assignments_operations import DenyAssignmentsOperations
-from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations
-from ._role_assignments_operations import RoleAssignmentsOperations
-from ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._deny_assignments_operations import DenyAssignmentsOperations # type: ignore
+from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations # type: ignore
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # 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 @@
"PermissionsOperations",
"RoleDefinitionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py
index 11bc2ef51898..682dede7af6d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_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,15 +19,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._deny_assignments_operations import (
build_get_by_id_request,
build_get_request,
@@ -37,6 +35,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]]
@@ -96,7 +98,6 @@ def list_for_resource(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -108,7 +109,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -119,7 +120,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -128,12 +129,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -144,14 +143,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("DenyAssignmentListResult", pipeline_response)
@@ -161,11 +159,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
@@ -178,10 +176,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -202,7 +196,6 @@ def list_for_resource_group(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -214,7 +207,7 @@ def list_for_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -225,17 +218,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -246,14 +237,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("DenyAssignmentListResult", pipeline_response)
@@ -263,11 +253,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
@@ -280,10 +270,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.DenyAssignment"]:
"""Gets all deny assignments for the subscription.
@@ -299,7 +285,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -311,7 +296,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -322,16 +307,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -342,14 +325,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("DenyAssignmentListResult", pipeline_response)
@@ -359,11 +341,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
@@ -376,8 +358,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"}
-
@distributed_trace_async
async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
"""Get the specified deny assignment.
@@ -386,12 +366,11 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode
:type scope: str
:param deny_assignment_id: The ID of the deny assignment to get. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -405,20 +384,18 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
deny_assignment_id=deny_assignment_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
@@ -428,14 +405,12 @@ async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _mode
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
@@ -447,12 +422,11 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den
/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny
assignments. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -466,19 +440,17 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
deny_assignment_id=deny_assignment_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -488,14 +460,12 @@ async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.Den
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -516,7 +486,6 @@ def list_for_scope(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -528,7 +497,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -539,16 +508,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -559,14 +526,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("DenyAssignmentListResult", pipeline_response)
@@ -576,11 +542,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
@@ -592,5 +558,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py
index 93f5baf144c1..2ffd9b7168df 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_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._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_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]]
@@ -60,7 +62,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
: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 Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission]
@@ -72,7 +73,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,16 +84,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -103,14 +102,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("PermissionGetResult", pipeline_response)
@@ -120,11 +118,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,10 +135,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -164,7 +158,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission]
@@ -176,7 +169,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -187,7 +180,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -195,12 +188,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -211,14 +202,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("PermissionGetResult", pipeline_response)
@@ -228,11 +218,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
@@ -244,7 +234,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py
index 938ae96af886..599c62fa50f8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_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._provider_operations_metadata_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]]
@@ -64,12 +66,11 @@ async def get(
:type resource_provider_namespace: str
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderOperationsMetadata or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -83,20 +84,18 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_provider_namespace=resource_provider_namespace,
expand=expand,
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
@@ -106,22 +105,20 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response)
+ deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_models.ProviderOperationsMetadata"]:
+ # pylint: disable=line-too-long
"""Gets provider operations metadata for all resource providers.
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderOperationsMetadata or the result of
cls(response)
:rtype:
@@ -134,7 +131,7 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,15 +142,13 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
expand=expand,
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
@@ -164,14 +159,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("ProviderOperationsMetadataListResult", pipeline_response)
@@ -181,11 +175,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
@@ -197,5 +191,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py
index b6070feb7f78..fdf32b363dd3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_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._role_assignments_operations import (
build_create_by_id_request,
build_create_request,
@@ -42,6 +40,10 @@
build_list_for_subscription_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,7 +80,6 @@ def list_for_subscription(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -90,7 +91,7 @@ def list_for_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -101,17 +102,15 @@ def list_for_subscription(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_subscription_request(
+ _request = build_list_for_subscription_request(
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_subscription.metadata["url"],
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
async def extract_data(pipeline_response):
deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response)
@@ -139,11 +137,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
@@ -156,10 +154,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_subscription.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -175,7 +169,6 @@ def list_for_resource_group(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -187,7 +180,7 @@ def list_for_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -198,18 +191,16 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -220,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
async def extract_data(pipeline_response):
deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response)
@@ -237,11 +227,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,10 +244,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -287,7 +273,6 @@ def list_for_resource(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -299,7 +284,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -310,7 +295,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
resource_type=resource_type,
@@ -319,12 +304,10 @@ def prepare_request(next_link=None):
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -335,14 +318,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("RoleAssignmentListResult", pipeline_response)
@@ -352,11 +334,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
@@ -369,14 +351,11 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace_async
async def get(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Get a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -390,12 +369,11 @@ async def get(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -409,21 +387,19 @@ async def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -433,14 +409,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("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
async def create(
@@ -452,6 +426,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -468,7 +443,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -479,11 +453,12 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -496,11 +471,10 @@ async def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -511,9 +485,10 @@ async def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -526,18 +501,14 @@ async def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -560,23 +531,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -586,23 +555,18 @@ async def create(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
-
@distributed_trace_async
async def delete(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> Optional[_models.RoleAssignment]:
+ # pylint: disable=line-too-long
"""Delete a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -616,12 +580,11 @@ async def delete(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -635,21 +598,19 @@ async def delete(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -661,14 +622,12 @@ async def delete(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -679,6 +638,7 @@ def list_for_scope(
skip_token: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable["_models.RoleAssignment"]:
+ # pylint: disable=line-too-long
"""List all role assignments that apply to a scope.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -697,7 +657,6 @@ def list_for_scope(
return paged role assignments following the skipToken passed. Only supported on provider level
calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -709,7 +668,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -720,18 +679,16 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
tenant_id=tenant_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -742,14 +699,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("RoleAssignmentListResult", pipeline_response)
@@ -759,11 +715,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
@@ -776,8 +732,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace_async
async def get_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -787,17 +741,17 @@ async def get_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -811,20 +765,18 @@ async def get_by_id(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -834,14 +786,12 @@ async def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
async def create_by_id(
@@ -857,15 +807,15 @@ async def create_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Required.
:type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -873,22 +823,22 @@ async def create_by_id(
@overload
async def create_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -896,29 +846,29 @@ async def create_by_id(
@distributed_trace_async
async def create_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -941,22 +891,20 @@ async def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -966,19 +914,13 @@ async def create_by_id(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_by_id.metadata = {"url": "/{roleAssignmentId}"}
-
@distributed_trace_async
async def delete_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -988,17 +930,17 @@ async def delete_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1012,20 +954,18 @@ async def delete_by_id(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -1037,11 +977,9 @@ async def delete_by_id(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py
index 4531a6c139d4..b35e2e172122 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_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._role_definitions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -37,6 +35,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,12 +71,11 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -88,20 +89,18 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -113,14 +112,12 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
@@ -130,12 +127,11 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -149,20 +145,18 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -172,14 +166,12 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -202,7 +194,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -213,7 +204,7 @@ async def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -225,11 +216,10 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -237,7 +227,11 @@ async def create_or_update(
@distributed_trace_async
async def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
"""Creates or updates a role definition.
@@ -246,17 +240,13 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
- :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ a IO[bytes] type. Required.
+ :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -279,23 +269,21 @@ async def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -305,14 +293,12 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]:
@@ -323,7 +309,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition]
@@ -335,7 +320,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -346,16 +331,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -366,14 +349,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("RoleDefinitionListResult", pipeline_response)
@@ -383,11 +365,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
@@ -400,8 +382,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace_async
async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -412,12 +392,11 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -431,19 +410,17 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -453,11 +430,9 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py
index 198470fcd79b..9e671346e87a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py
@@ -5,51 +5,62 @@
# 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 ApprovalSettings
-from ._models_py3 import ApprovalStage
-from ._models_py3 import DenyAssignment
-from ._models_py3 import DenyAssignmentFilter
-from ._models_py3 import DenyAssignmentListResult
-from ._models_py3 import DenyAssignmentPermission
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Permission
-from ._models_py3 import PermissionGetResult
-from ._models_py3 import Principal
-from ._models_py3 import ProviderOperation
-from ._models_py3 import ProviderOperationsMetadata
-from ._models_py3 import ProviderOperationsMetadataListResult
-from ._models_py3 import ResourceType
-from ._models_py3 import RoleAssignment
-from ._models_py3 import RoleAssignmentCreateParameters
-from ._models_py3 import RoleAssignmentFilter
-from ._models_py3 import RoleAssignmentListResult
-from ._models_py3 import RoleDefinition
-from ._models_py3 import RoleDefinitionFilter
-from ._models_py3 import RoleDefinitionListResult
-from ._models_py3 import RoleManagementPolicyApprovalRule
-from ._models_py3 import RoleManagementPolicyAuthenticationContextRule
-from ._models_py3 import RoleManagementPolicyEnablementRule
-from ._models_py3 import RoleManagementPolicyExpirationRule
-from ._models_py3 import RoleManagementPolicyNotificationRule
-from ._models_py3 import RoleManagementPolicyRule
-from ._models_py3 import RoleManagementPolicyRuleTarget
-from ._models_py3 import UserSet
-from ._models_py3 import ValidationResponse
-from ._models_py3 import ValidationResponseErrorInfo
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import ApprovalMode
-from ._authorization_management_client_enums import EnablementRules
-from ._authorization_management_client_enums import NotificationDeliveryMechanism
-from ._authorization_management_client_enums import NotificationLevel
-from ._authorization_management_client_enums import PrincipalType
-from ._authorization_management_client_enums import RecipientType
-from ._authorization_management_client_enums import RoleManagementPolicyRuleType
-from ._authorization_management_client_enums import UserType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ApprovalSettings,
+ ApprovalStage,
+ DenyAssignment,
+ DenyAssignmentFilter,
+ DenyAssignmentListResult,
+ DenyAssignmentPermission,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Permission,
+ PermissionGetResult,
+ Principal,
+ ProviderOperation,
+ ProviderOperationsMetadata,
+ ProviderOperationsMetadataListResult,
+ ResourceType,
+ RoleAssignment,
+ RoleAssignmentCreateParameters,
+ RoleAssignmentFilter,
+ RoleAssignmentListResult,
+ RoleDefinition,
+ RoleDefinitionFilter,
+ RoleDefinitionListResult,
+ RoleManagementPolicyApprovalRule,
+ RoleManagementPolicyAuthenticationContextRule,
+ RoleManagementPolicyEnablementRule,
+ RoleManagementPolicyExpirationRule,
+ RoleManagementPolicyNotificationRule,
+ RoleManagementPolicyRule,
+ RoleManagementPolicyRuleTarget,
+ UserSet,
+ ValidationResponse,
+ ValidationResponseErrorInfo,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ ApprovalMode,
+ EnablementRules,
+ NotificationDeliveryMechanism,
+ NotificationLevel,
+ PrincipalType,
+ RecipientType,
+ RoleManagementPolicyRuleType,
+ UserType,
+)
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__ = [
@@ -95,5 +106,5 @@
"RoleManagementPolicyRuleType",
"UserType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py
index a25c36472046..fee1d89df87a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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.
@@ -15,10 +15,9 @@
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
- from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
@@ -148,7 +147,7 @@ def __init__(
self.escalation_approvers = escalation_approvers
-class DenyAssignment(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class DenyAssignment(_serialization.Model):
"""Deny Assignment.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -827,7 +826,7 @@ def __init__(
self.operations = operations
-class RoleAssignment(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignment(_serialization.Model):
"""Role Assignments.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -951,12 +950,12 @@ def __init__(
self.delegated_managed_identity_resource_id = delegated_managed_identity_resource_id
-class RoleAssignmentCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentCreateParameters(_serialization.Model):
"""Role assignment create parameters.
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 scope: The role assignment scope.
:vartype scope: str
@@ -1114,7 +1113,7 @@ def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, **
self.next_link = None
-class RoleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleDefinition(_serialization.Model):
"""Role definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1269,7 +1268,7 @@ class RoleManagementPolicyRule(_serialization.Model):
RoleManagementPolicyEnablementRule, RoleManagementPolicyExpirationRule,
RoleManagementPolicyNotificationRule
- 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: The id of the rule.
:vartype id: str
@@ -1325,7 +1324,7 @@ def __init__(
class RoleManagementPolicyApprovalRule(RoleManagementPolicyRule):
"""The role management policy approval rule.
- 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: The id of the rule.
:vartype id: str
@@ -1373,10 +1372,10 @@ def __init__(
self.setting = setting
-class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule):
+class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule): # pylint: disable=name-too-long
"""The role management policy authentication context rule.
- 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: The id of the rule.
:vartype id: str
@@ -1434,7 +1433,7 @@ def __init__(
class RoleManagementPolicyEnablementRule(RoleManagementPolicyRule):
"""The role management policy enablement rule.
- 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: The id of the rule.
:vartype id: str
@@ -1487,7 +1486,7 @@ def __init__(
class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule):
"""The role management policy expiration rule.
- 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: The id of the rule.
:vartype id: str
@@ -1545,7 +1544,7 @@ def __init__(
class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule):
"""The role management policy notification rule.
- 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: The id of the rule.
:vartype id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py
index 336442a84fe5..8679ec8c6d15 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/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 ._deny_assignments_operations import DenyAssignmentsOperations
-from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations
-from ._role_assignments_operations import RoleAssignmentsOperations
-from ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._deny_assignments_operations import DenyAssignmentsOperations # type: ignore
+from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations # type: ignore
+from ._role_assignments_operations import RoleAssignmentsOperations # type: ignore
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # 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 @@
"PermissionsOperations",
"RoleDefinitionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py
index e3c38c4ba49e..16e536ec9723 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_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, _format_url_section
+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]]
@@ -71,7 +73,7 @@ def build_list_for_resource_request(
"resourceName": _SERIALIZER.url("resource_name", resource_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -105,7 +107,7 @@ def build_list_for_resource_group_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -133,7 +135,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -160,7 +162,7 @@ def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> Htt
"denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -184,7 +186,7 @@ def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpReque
"denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -208,7 +210,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -276,7 +278,6 @@ def list_for_resource(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -288,7 +289,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -299,7 +300,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -308,12 +309,10 @@ def prepare_request(next_link=None):
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -324,14 +323,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("DenyAssignmentListResult", pipeline_response)
@@ -341,11 +339,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
@@ -358,10 +356,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any
@@ -382,7 +376,6 @@ def list_for_resource_group(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -394,7 +387,7 @@ def list_for_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -405,17 +398,15 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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
@@ -426,14 +417,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("DenyAssignmentListResult", pipeline_response)
@@ -443,11 +433,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
@@ -460,10 +450,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments"
- }
-
@distributed_trace
def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.DenyAssignment"]:
"""Gets all deny assignments for the subscription.
@@ -479,7 +465,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -491,7 +476,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -502,16 +487,14 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
filter=filter,
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
@@ -522,14 +505,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("DenyAssignmentListResult", pipeline_response)
@@ -539,11 +521,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
@@ -556,8 +538,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"}
-
@distributed_trace
def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
"""Get the specified deny assignment.
@@ -566,12 +546,11 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den
:type scope: str
:param deny_assignment_id: The ID of the deny assignment to get. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -585,20 +564,18 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
deny_assignment_id=deny_assignment_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
@@ -608,14 +585,12 @@ def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.Den
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment:
@@ -627,12 +602,11 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig
/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny
assignments. Required.
:type deny_assignment_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DenyAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -646,19 +620,17 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
deny_assignment_id=deny_assignment_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -668,14 +640,12 @@ def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssig
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DenyAssignment", pipeline_response)
+ deserialized = self._deserialize("DenyAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get_by_id.metadata = {"url": "/{denyAssignmentId}"}
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -696,7 +666,6 @@ def list_for_scope(
ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny
assignment name and description properties are returned. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DenyAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment]
@@ -708,7 +677,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -719,16 +688,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -739,14 +706,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("DenyAssignmentListResult", pipeline_response)
@@ -756,11 +722,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
@@ -772,5 +738,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py
index 5d68e5e0b826..22724b9c3cb3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -99,7 +101,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -137,7 +139,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
: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 Permission or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -148,7 +149,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -159,16 +160,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -179,14 +178,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("PermissionGetResult", pipeline_response)
@@ -196,11 +194,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
@@ -213,10 +211,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -240,7 +234,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -251,7 +244,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -262,7 +255,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -270,12 +263,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -286,14 +277,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("PermissionGetResult", pipeline_response)
@@ -303,11 +293,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
@@ -319,7 +309,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py
index fa030854e946..e15493082e12 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -117,12 +119,11 @@ def get(
:type resource_provider_namespace: str
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ProviderOperationsMetadata or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -136,20 +137,18 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_provider_namespace=resource_provider_namespace,
expand=expand,
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
@@ -159,14 +158,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response)
+ deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_models.ProviderOperationsMetadata"]:
@@ -174,7 +171,6 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
:param expand: Specifies whether to expand the values. Default value is "resourceTypes".
:type expand: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ProviderOperationsMetadata or the result of
cls(response)
:rtype:
@@ -187,7 +183,7 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -198,15 +194,13 @@ def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_model
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
expand=expand,
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
@@ -217,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("ProviderOperationsMetadataListResult", pipeline_response)
@@ -234,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
@@ -250,5 +243,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py
index 5f8931ac23e9..5814bd4c8083 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py
@@ -7,6 +7,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 +21,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, _format_url_section
+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]]
@@ -54,7 +57,7 @@ def build_list_for_subscription_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -95,7 +98,7 @@ def build_list_for_resource_group_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -144,7 +147,7 @@ def build_list_for_resource_request(
"resourceName": _SERIALIZER.url("resource_name", resource_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -175,7 +178,7 @@ def build_get_request(
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -203,7 +206,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -232,7 +235,7 @@ def build_delete_request(
"roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -265,7 +268,7 @@ def build_list_for_scope_request(
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -295,7 +298,7 @@ def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str]
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -322,7 +325,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -350,7 +353,7 @@ def build_delete_by_id_request(
"roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -395,7 +398,6 @@ def list_for_subscription(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -407,7 +409,7 @@ def list_for_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,17 +420,15 @@ def list_for_subscription(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_subscription_request(
+ _request = build_list_for_subscription_request(
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_subscription.metadata["url"],
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
@@ -439,14 +439,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("RoleAssignmentListResult", pipeline_response)
@@ -456,11 +455,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
@@ -473,10 +472,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_subscription.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource_group(
self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any
@@ -492,7 +487,6 @@ def list_for_resource_group(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -504,7 +498,7 @@ def list_for_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -515,18 +509,16 @@ def list_for_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -537,14 +529,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("RoleAssignmentListResult", pipeline_response)
@@ -554,11 +545,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
@@ -571,10 +562,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -604,7 +591,6 @@ def list_for_resource(
:type filter: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -616,7 +602,7 @@ def list_for_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -627,7 +613,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
resource_type=resource_type,
@@ -636,12 +622,10 @@ def prepare_request(next_link=None):
filter=filter,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -652,14 +636,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("RoleAssignmentListResult", pipeline_response)
@@ -669,11 +652,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
@@ -686,14 +669,11 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments"
- }
-
@distributed_trace
def get(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Get a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -707,12 +687,11 @@ def get(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -726,21 +705,19 @@ def get(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -750,14 +727,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@overload
def create(
@@ -769,6 +744,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -785,7 +761,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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -796,11 +771,12 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -813,11 +789,10 @@ def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -828,9 +803,10 @@ def create(
self,
scope: str,
role_assignment_name: str,
- parameters: Union[_models.RoleAssignmentCreateParameters, IO],
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignment:
+ # pylint: disable=line-too-long
"""Create or update a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -843,18 +819,14 @@ def create(
Required.
:type role_assignment_name: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -877,23 +849,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_name=role_assignment_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -903,23 +873,18 @@ def create(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
-
@distributed_trace
def delete(
self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any
) -> Optional[_models.RoleAssignment]:
+ # pylint: disable=line-too-long
"""Delete a role assignment by scope and name.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -933,12 +898,11 @@ def delete(
:type role_assignment_name: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -952,21 +916,19 @@ def delete(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_assignment_name=role_assignment_name,
tenant_id=tenant_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
@@ -978,14 +940,12 @@ def delete(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"}
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
@@ -996,6 +956,7 @@ def list_for_scope(
skip_token: Optional[str] = None,
**kwargs: Any
) -> Iterable["_models.RoleAssignment"]:
+ # pylint: disable=line-too-long
"""List all role assignments that apply to a scope.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -1014,7 +975,6 @@ def list_for_scope(
return paged role assignments following the skipToken passed. Only supported on provider level
calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignment or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment]
@@ -1026,7 +986,7 @@ def list_for_scope(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1037,18 +997,16 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
tenant_id=tenant_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -1059,14 +1017,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("RoleAssignmentListResult", pipeline_response)
@@ -1076,11 +1033,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
@@ -1093,8 +1050,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"}
-
@distributed_trace
def get_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -1104,17 +1059,17 @@ def get_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1128,20 +1083,18 @@ def get_by_id(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -1151,14 +1104,12 @@ def get_by_id(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
@overload
def create_by_id(
@@ -1174,15 +1125,15 @@ def create_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Required.
:type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1190,22 +1141,22 @@ def create_by_id(
@overload
def create_by_id(
- self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, role_assignment_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. 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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1213,29 +1164,29 @@ def create_by_id(
@distributed_trace
def create_by_id(
- self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any
+ self,
+ role_assignment_id: str,
+ parameters: Union[_models.RoleAssignmentCreateParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleAssignment:
"""Create or update a role assignment by ID.
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param parameters: Parameters for the role assignment. Is either a
- RoleAssignmentCreateParameters type or a IO type. Required.
+ RoleAssignmentCreateParameters type or a IO[bytes] type. Required.
:type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters
- or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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: RoleAssignment or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1258,22 +1209,20 @@ def create_by_id(
else:
_json = self._serialize.body(parameters, "RoleAssignmentCreateParameters")
- request = build_create_by_id_request(
+ _request = build_create_by_id_request(
role_assignment_id=role_assignment_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_by_id.metadata["url"],
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
@@ -1283,19 +1232,13 @@ def create_by_id(
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("RoleAssignment", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- create_by_id.metadata = {"url": "/{roleAssignmentId}"}
-
@distributed_trace
def delete_by_id(
self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any
@@ -1305,17 +1248,17 @@ def delete_by_id(
:param role_assignment_id: The fully qualified ID of the role assignment including scope,
resource name, and resource type. Format:
/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example:
- /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``.
- Required.
+ /subscriptions/\\ :code:``/resourcegroups/\\
+ :code:``/providers/Microsoft.Authorization/roleAssignments/\\
+ :code:``. Required.
:type role_assignment_id: str
:param tenant_id: Tenant ID for cross-tenant request. Default value is None.
:type tenant_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignment or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1329,20 +1272,18 @@ def delete_by_id(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None)
- request = build_delete_by_id_request(
+ _request = build_delete_by_id_request(
role_assignment_id=role_assignment_id,
tenant_id=tenant_id,
api_version=api_version,
- template_url=self.delete_by_id.metadata["url"],
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
@@ -1354,11 +1295,9 @@ def delete_by_id(
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleAssignment", pipeline_response)
+ deserialized = self._deserialize("RoleAssignment", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- delete_by_id.metadata = {"url": "/{roleAssignmentId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py
index a5f86335ed00..03f65825f22f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) ->
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,7 +78,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -102,7 +104,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -128,7 +130,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -154,7 +156,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -193,12 +195,11 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,20 +213,18 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -237,14 +236,12 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
@@ -254,12 +251,11 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -273,20 +269,18 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -296,14 +290,12 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -326,7 +318,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -337,7 +328,7 @@ def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -349,11 +340,10 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -361,7 +351,11 @@ def create_or_update(
@distributed_trace
def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
"""Creates or updates a role definition.
@@ -370,17 +364,13 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
- :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ a IO[bytes] type. Required.
+ :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -403,23 +393,21 @@ def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -429,14 +417,12 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]:
@@ -447,7 +433,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition]
@@ -459,7 +444,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -470,16 +455,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -490,14 +473,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("RoleDefinitionListResult", pipeline_response)
@@ -507,11 +489,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
@@ -524,8 +506,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace
def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -536,12 +516,11 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -555,19 +534,17 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01"))
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -577,11 +554,9 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_authorization_management_client.py
index fc34514cd200..a9546362d30a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_authorization_management_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 RoleAssignmentScheduleRequestsOperations, RoleEligibilityScheduleRequestsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -46,7 +48,25 @@ def __init__(
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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)
@@ -59,7 +79,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-04-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
@@ -79,12 +99,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_configuration.py
index d5cab6d0c942..9225e346e1cf 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-04-01-preview")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_metadata.json
index a256424cc2ad..c941c4dc392c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -88,8 +88,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": {
"role_assignment_schedule_requests": "RoleAssignmentScheduleRequestsOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_authorization_management_client.py
index cf6c398f9abd..8573e2b881eb 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_authorization_management_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 RoleAssignmentScheduleRequestsOperations, RoleEligibilityScheduleRequestsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -46,7 +48,25 @@ def __init__(
self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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)
@@ -59,7 +79,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-04-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
@@ -79,12 +101,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_configuration.py
index 4682afc08b7d..c2e4ea2e15d0 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-04-01-preview")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/__init__.py
index 8321ef0252af..ad1010e5a270 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations
-from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations # type: ignore
+from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations # 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__ = [
"RoleAssignmentScheduleRequestsOperations",
"RoleEligibilityScheduleRequestsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py
index ca3e5a81d474..07f3378b28ed 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_assignment_schedule_requests_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._role_assignment_schedule_requests_operations import (
build_cancel_request,
build_create_request,
@@ -37,6 +35,10 @@
build_validate_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]]
@@ -71,6 +73,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -90,7 +93,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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -101,11 +103,12 @@ async def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -120,11 +123,10 @@ async def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -135,9 +137,10 @@ async def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -152,18 +155,14 @@ async def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,23 +187,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -213,16 +210,12 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -235,12 +228,11 @@ async def get(
:param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule
request to get. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -256,20 +248,18 @@ async def get(
)
cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
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
@@ -278,21 +268,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleAssignmentScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule requests for a scope.
:param scope: The scope of the role assignments schedule requests. Required.
@@ -305,7 +292,6 @@ def list_for_scope(
for the current user. Use $filter=asApprover() to return all role assignment schedule requests
where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of
cls(response)
:rtype:
@@ -320,7 +306,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -331,16 +317,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -351,14 +335,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("RoleAssignmentScheduleRequestListResult", pipeline_response)
@@ -368,11 +351,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
@@ -384,12 +367,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"}
-
@distributed_trace_async
- async def cancel( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any
- ) -> None:
+ async def cancel(self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any) -> None:
"""Cancels a pending role assignment schedule request.
:param scope: The scope of the role assignment request to cancel. Required.
@@ -397,12 +376,11 @@ async def cancel( # pylint: disable=inconsistent-return-statements
:param role_assignment_schedule_request_name: The name of the role assignment request to
cancel. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,20 +396,18 @@ async def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -441,11 +417,7 @@ async def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def validate(
@@ -470,7 +442,6 @@ async def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -481,7 +452,7 @@ async def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -494,11 +465,10 @@ async def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -509,7 +479,7 @@ async def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
"""Validates a new role assignment schedule request.
@@ -520,18 +490,14 @@ async def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -556,23 +522,21 @@ async def validate(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -581,13 +545,9 @@ async def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py
index 530046bd23c0..c116e163bbb0 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_eligibility_schedule_requests_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._role_eligibility_schedule_requests_operations import (
build_cancel_request,
build_create_request,
@@ -37,11 +35,15 @@
build_validate_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 RoleEligibilityScheduleRequestsOperations:
+class RoleEligibilityScheduleRequestsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -71,6 +73,7 @@ async def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -90,7 +93,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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -101,11 +103,12 @@ async def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -120,11 +123,10 @@ async def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -135,9 +137,10 @@ async def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -152,18 +155,15 @@ async def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or
+ IO[bytes]
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,23 +188,21 @@ async def create(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -213,16 +211,12 @@ async def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def get(
@@ -235,12 +229,11 @@ async def get(
:param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule
request to get. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -256,20 +249,18 @@ async def get(
)
cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
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
@@ -278,21 +269,18 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> AsyncIterable["_models.RoleEligibilityScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule requests for a scope.
:param scope: The scope of the role eligibility schedule requests. Required.
@@ -305,7 +293,6 @@ def list_for_scope(
created for the current user. Use $filter=asApprover() to return all role eligibility schedule
requests where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of
cls(response)
:rtype:
@@ -320,7 +307,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -331,16 +318,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -351,14 +336,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("RoleEligibilityScheduleRequestListResult", pipeline_response)
@@ -368,11 +352,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
@@ -384,12 +368,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"}
-
@distributed_trace_async
- async def cancel( # pylint: disable=inconsistent-return-statements
- self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any
- ) -> None:
+ async def cancel(self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any) -> None:
"""Cancels a pending role eligibility schedule request.
:param scope: The scope of the role eligibility request to cancel. Required.
@@ -397,12 +377,11 @@ async def cancel( # pylint: disable=inconsistent-return-statements
:param role_eligibility_schedule_request_name: The name of the role eligibility request to
cancel. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,20 +397,18 @@ async def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -441,11 +418,7 @@ async def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
async def validate(
@@ -470,7 +443,6 @@ async def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -481,7 +453,7 @@ async def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -494,11 +466,10 @@ async def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -509,7 +480,7 @@ async def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
"""Validates a new role eligibility schedule request.
@@ -520,18 +491,15 @@ async def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or
+ IO[bytes]
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -556,23 +524,21 @@ async def validate(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -581,13 +547,9 @@ async def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/__init__.py
index dcfd7d49a517..a8fb3e932000 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/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 CloudErrorBody
-from ._models_py3 import ExpandedProperties
-from ._models_py3 import ExpandedPropertiesPrincipal
-from ._models_py3 import ExpandedPropertiesRoleDefinition
-from ._models_py3 import ExpandedPropertiesScope
-from ._models_py3 import RoleAssignmentScheduleRequest
-from ._models_py3 import RoleAssignmentScheduleRequestFilter
-from ._models_py3 import RoleAssignmentScheduleRequestListResult
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfo
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration
-from ._models_py3 import RoleAssignmentScheduleRequestPropertiesTicketInfo
-from ._models_py3 import RoleEligibilityScheduleRequest
-from ._models_py3 import RoleEligibilityScheduleRequestFilter
-from ._models_py3 import RoleEligibilityScheduleRequestListResult
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfo
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration
-from ._models_py3 import RoleEligibilityScheduleRequestPropertiesTicketInfo
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import PrincipalType
-from ._authorization_management_client_enums import RequestType
-from ._authorization_management_client_enums import Status
-from ._authorization_management_client_enums import Type
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ CloudErrorBody,
+ ExpandedProperties,
+ ExpandedPropertiesPrincipal,
+ ExpandedPropertiesRoleDefinition,
+ ExpandedPropertiesScope,
+ RoleAssignmentScheduleRequest,
+ RoleAssignmentScheduleRequestFilter,
+ RoleAssignmentScheduleRequestListResult,
+ RoleAssignmentScheduleRequestPropertiesScheduleInfo,
+ RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration,
+ RoleAssignmentScheduleRequestPropertiesTicketInfo,
+ RoleEligibilityScheduleRequest,
+ RoleEligibilityScheduleRequestFilter,
+ RoleEligibilityScheduleRequestListResult,
+ RoleEligibilityScheduleRequestPropertiesScheduleInfo,
+ RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration,
+ RoleEligibilityScheduleRequestPropertiesTicketInfo,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ PrincipalType,
+ RequestType,
+ Status,
+ Type,
+)
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 @@
"Status",
"Type",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_models_py3.py
index ae6cb622ab14..9913a050cc09 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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
@@ -214,7 +212,7 @@ def __init__(
self.type = type
-class RoleAssignmentScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleAssignmentScheduleRequest(_serialization.Model):
"""Role Assignment schedule request.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -479,7 +477,7 @@ def __init__(
self.next_link = next_link
-class RoleAssignmentScheduleRequestPropertiesScheduleInfo(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesScheduleInfo(_serialization.Model): # pylint: disable=name-too-long
"""Schedule info of the role assignment schedule.
:ivar start_date_time: Start DateTime of the role assignment schedule.
@@ -506,14 +504,16 @@ def __init__(
:paramtype start_date_time: ~datetime.datetime
:keyword expiration: Expiration of the role assignment schedule.
:paramtype expiration:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration
+ ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration # pylint: disable=line-too-long
"""
super().__init__(**kwargs)
self.start_date_time = start_date_time
self.expiration = expiration
-class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(
+ _serialization.Model
+): # pylint: disable=name-too-long
"""Expiration of the role assignment schedule.
:ivar type: Type of the role assignment schedule expiration. Known values are: "AfterDuration",
@@ -554,7 +554,7 @@ def __init__(
self.duration = duration
-class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model):
+class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model): # pylint: disable=name-too-long
"""Ticket Info of the role assignment.
:ivar ticket_number: Ticket number for the role assignment.
@@ -582,7 +582,7 @@ def __init__(
self.ticket_system = ticket_system
-class RoleEligibilityScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleEligibilityScheduleRequest(_serialization.Model):
"""Role Eligibility schedule request.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -838,7 +838,7 @@ def __init__(
self.next_link = next_link
-class RoleEligibilityScheduleRequestPropertiesScheduleInfo(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesScheduleInfo(_serialization.Model): # pylint: disable=name-too-long
"""Schedule info of the role eligibility schedule.
:ivar start_date_time: Start DateTime of the role eligibility schedule.
@@ -865,14 +865,16 @@ def __init__(
:paramtype start_date_time: ~datetime.datetime
:keyword expiration: Expiration of the role eligibility schedule.
:paramtype expiration:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration
+ ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration # pylint: disable=line-too-long
"""
super().__init__(**kwargs)
self.start_date_time = start_date_time
self.expiration = expiration
-class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(
+ _serialization.Model
+): # pylint: disable=name-too-long
"""Expiration of the role eligibility schedule.
:ivar type: Type of the role eligibility schedule expiration. Known values are:
@@ -913,7 +915,7 @@ def __init__(
self.duration = duration
-class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model):
+class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model): # pylint: disable=name-too-long
"""Ticket Info of the role eligibility.
:ivar ticket_number: Ticket number for the role eligibility.
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/__init__.py
index 8321ef0252af..ad1010e5a270 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_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 ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations
-from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations # type: ignore
+from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations # 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__ = [
"RoleAssignmentScheduleRequestsOperations",
"RoleEligibilityScheduleRequestsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_assignment_schedule_requests_operations.py
index fdb871273b10..4c4da5f71c3b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_assignment_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_assignment_schedule_requests_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, _format_url_section
+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]]
@@ -57,7 +59,7 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,7 +91,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, **
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,7 +115,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -145,7 +147,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str,
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -176,7 +178,7 @@ def build_validate_request(scope: str, role_assignment_schedule_request_name: st
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -219,6 +221,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -238,7 +241,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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -249,11 +251,12 @@ def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -268,11 +271,10 @@ def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -283,9 +285,10 @@ def create(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role assignment schedule request.
:param scope: The scope of the role assignment schedule request to create. The scope can be any
@@ -300,18 +303,14 @@ def create(
name must be unique and different for each role assignment. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -336,23 +335,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -361,16 +358,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -383,12 +376,11 @@ def get(
:param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule
request to get. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -404,20 +396,18 @@ def get(
)
cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
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
@@ -426,21 +416,18 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.RoleAssignmentScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role assignment schedule requests for a scope.
:param scope: The scope of the role assignments schedule requests. Required.
@@ -453,7 +440,6 @@ def list_for_scope(
for the current user. Use $filter=asApprover() to return all role assignment schedule requests
where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of
cls(response)
:rtype:
@@ -468,7 +454,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -479,16 +465,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -499,14 +483,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("RoleAssignmentScheduleRequestListResult", pipeline_response)
@@ -516,11 +499,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
@@ -532,8 +515,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"}
-
@distributed_trace
def cancel( # pylint: disable=inconsistent-return-statements
self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any
@@ -545,12 +526,11 @@ def cancel( # pylint: disable=inconsistent-return-statements
:param role_assignment_schedule_request_name: The name of the role assignment request to
cancel. Required.
:type role_assignment_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -566,20 +546,18 @@ def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -589,11 +567,7 @@ def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def validate(
@@ -618,7 +592,6 @@ def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -629,7 +602,7 @@ def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -642,11 +615,10 @@ def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. 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: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -657,7 +629,7 @@ def validate(
self,
scope: str,
role_assignment_schedule_request_name: str,
- parameters: Union[_models.RoleAssignmentScheduleRequest, IO],
+ parameters: Union[_models.RoleAssignmentScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleAssignmentScheduleRequest:
"""Validates a new role assignment schedule request.
@@ -668,18 +640,14 @@ def validate(
validate. Required.
:type role_assignment_schedule_request_name: str
:param parameters: Parameters for the role assignment schedule request. Is either a
- RoleAssignmentScheduleRequest type or a IO type. Required.
+ RoleAssignmentScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO[bytes]
:return: RoleAssignmentScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -704,23 +672,21 @@ def validate(
else:
_json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_assignment_schedule_request_name=role_assignment_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -729,13 +695,9 @@ def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_eligibility_schedule_requests_operations.py
index c1665930d929..dc9ac880ab4c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_eligibility_schedule_requests_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_eligibility_schedule_requests_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, _format_url_section
+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]]
@@ -57,7 +59,7 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,7 +91,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, *
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,7 +115,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -145,7 +147,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -176,7 +178,7 @@ def build_validate_request(scope: str, role_eligibility_schedule_request_name: s
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -189,7 +191,7 @@ def build_validate_request(scope: str, role_eligibility_schedule_request_name: s
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
-class RoleEligibilityScheduleRequestsOperations:
+class RoleEligibilityScheduleRequestsOperations: # pylint: disable=name-too-long
"""
.. warning::
**DO NOT** instantiate this class directly.
@@ -219,6 +221,7 @@ def create(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -238,7 +241,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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -249,11 +251,12 @@ def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -268,11 +271,10 @@ def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -283,9 +285,10 @@ def create(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
+ # pylint: disable=line-too-long
"""Creates a role eligibility schedule request.
:param scope: The scope of the role eligibility schedule request to create. The scope can be
@@ -300,18 +303,15 @@ def create(
can be any valid GUID. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or
+ IO[bytes]
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -336,23 +336,21 @@ def create(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_create_request(
+ _request = build_create_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -361,16 +359,12 @@ def create(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def get(
@@ -383,12 +377,11 @@ def get(
:param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule
request to get. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -404,20 +397,18 @@ def get(
)
cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
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
@@ -426,21 +417,18 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(
self, scope: str, filter: Optional[str] = None, **kwargs: Any
) -> Iterable["_models.RoleEligibilityScheduleRequest"]:
+ # pylint: disable=line-too-long
"""Gets role eligibility schedule requests for a scope.
:param scope: The scope of the role eligibility schedule requests. Required.
@@ -453,7 +441,6 @@ def list_for_scope(
created for the current user. Use $filter=asApprover() to return all role eligibility schedule
requests where the current user is an approver. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of
cls(response)
:rtype:
@@ -468,7 +455,7 @@ def list_for_scope(
)
cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -479,16 +466,14 @@ def list_for_scope(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
filter=filter,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -499,14 +484,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("RoleEligibilityScheduleRequestListResult", pipeline_response)
@@ -516,11 +500,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
@@ -532,8 +516,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"}
-
@distributed_trace
def cancel( # pylint: disable=inconsistent-return-statements
self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any
@@ -545,12 +527,11 @@ def cancel( # pylint: disable=inconsistent-return-statements
:param role_eligibility_schedule_request_name: The name of the role eligibility request to
cancel. Required.
:type role_eligibility_schedule_request_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -566,20 +547,18 @@ def cancel( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_cancel_request(
+ _request = build_cancel_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
- template_url=self.cancel.metadata["url"],
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
@@ -589,11 +568,7 @@ def cancel( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- cancel.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
@overload
def validate(
@@ -618,7 +593,6 @@ def validate(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -629,7 +603,7 @@ def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: IO,
+ parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -642,11 +616,10 @@ def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. 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: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
@@ -657,7 +630,7 @@ def validate(
self,
scope: str,
role_eligibility_schedule_request_name: str,
- parameters: Union[_models.RoleEligibilityScheduleRequest, IO],
+ parameters: Union[_models.RoleEligibilityScheduleRequest, IO[bytes]],
**kwargs: Any
) -> _models.RoleEligibilityScheduleRequest:
"""Validates a new role eligibility schedule request.
@@ -668,18 +641,15 @@ def validate(
validate. Required.
:type role_eligibility_schedule_request_name: str
:param parameters: Parameters for the role eligibility schedule request. Is either a
- RoleEligibilityScheduleRequest type or a IO type. Required.
+ RoleEligibilityScheduleRequest type or a IO[bytes] type. Required.
:type parameters:
- ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or
+ IO[bytes]
:return: RoleEligibilityScheduleRequest or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -704,23 +674,21 @@ def validate(
else:
_json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest")
- request = build_validate_request(
+ _request = build_validate_request(
scope=scope,
role_eligibility_schedule_request_name=role_eligibility_schedule_request_name,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.validate.metadata["url"],
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
@@ -729,13 +697,9 @@ def validate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response)
+ deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- validate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate"
- }
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_authorization_management_client.py
index 58368cbfc3bf..cbb7fab132ea 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_authorization_management_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 PermissionsOperations, RoleDefinitionsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations allow you to manage role
definitions. A role definition describes the set of actions that can be performed on resources.
@@ -54,7 +56,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -67,7 +87,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-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
@@ -87,12 +107,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_configuration.py
index 81e24c62142a..a574eab95fa3 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_metadata.json
index a704fb3cd3fa..3d6ff218225b 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_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": 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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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": {
"permissions": "PermissionsOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_authorization_management_client.py
index 2e673e62c793..3bd60dd48dc4 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_authorization_management_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 PermissionsOperations, RoleDefinitionsOperations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations allow you to manage role
definitions. A role definition describes the set of actions that can be performed on resources.
@@ -54,7 +56,25 @@ def __init__(
self._config = AuthorizationManagementClientConfiguration(
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)
@@ -67,7 +87,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-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
@@ -87,12 +109,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_configuration.py
index bb2c60526bea..cdc85863500d 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -35,7 +33,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-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-authorization/{}".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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/__init__.py
index 10fe5b64a01c..fbf230bef908 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_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 ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # 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__ = [
"PermissionsOperations",
"RoleDefinitionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_permissions_operations.py
index 6427bc44c427..2e82ebed96ef 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_permissions_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._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_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]]
@@ -60,7 +62,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
: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 Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission]
@@ -74,7 +75,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,16 +86,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> As
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -105,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("PermissionGetResult", pipeline_response)
@@ -122,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
@@ -139,10 +137,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -166,7 +160,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission]
@@ -180,7 +173,7 @@ def list_for_resource(
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,7 +184,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -199,12 +192,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -215,14 +206,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("PermissionGetResult", pipeline_response)
@@ -232,11 +222,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
@@ -248,7 +238,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_role_definitions_operations.py
index e29e62d7fb75..417c5162e8d1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_role_definitions_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._role_definitions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -37,6 +35,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]]
@@ -63,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace_async
async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional[_models.RoleDefinition]:
+ # pylint: disable=line-too-long
"""Deletes a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -73,12 +76,11 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -94,20 +96,18 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
)
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -119,17 +119,16 @@ async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Op
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace_async
async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Get role definition by ID (GUID).
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -140,12 +139,11 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -161,20 +159,18 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -184,14 +180,12 @@ async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _mode
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -203,6 +197,7 @@ async def create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Creates or updates a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -218,7 +213,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -229,11 +223,12 @@ async def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Creates or updates a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -245,11 +240,10 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -257,8 +251,13 @@ async def create_or_update(
@distributed_trace_async
async def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Creates or updates a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -270,18 +269,14 @@ async def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
+ a IO[bytes] type. Required.
:type role_definition: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -306,23 +301,21 @@ async def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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,17 +325,16 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]:
+ # pylint: disable=line-too-long
"""Get all role definitions that are applicable at scope and above.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -354,7 +346,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition]
@@ -368,7 +359,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
)
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -379,16 +370,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Async
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -399,14 +388,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("RoleDefinitionListResult", pipeline_response)
@@ -416,11 +404,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
@@ -433,8 +421,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace_async
async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -445,12 +431,11 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -466,19 +451,17 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -488,11 +471,9 @@ async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/__init__.py
index 8c30802fc8d8..fc966ddf149c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/__init__.py
@@ -5,36 +5,47 @@
# 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 ApprovalSettings
-from ._models_py3 import ApprovalStage
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import Permission
-from ._models_py3 import PermissionGetResult
-from ._models_py3 import Principal
-from ._models_py3 import RoleDefinition
-from ._models_py3 import RoleDefinitionFilter
-from ._models_py3 import RoleDefinitionListResult
-from ._models_py3 import RoleManagementPolicyApprovalRule
-from ._models_py3 import RoleManagementPolicyAuthenticationContextRule
-from ._models_py3 import RoleManagementPolicyEnablementRule
-from ._models_py3 import RoleManagementPolicyExpirationRule
-from ._models_py3 import RoleManagementPolicyNotificationRule
-from ._models_py3 import RoleManagementPolicyRule
-from ._models_py3 import RoleManagementPolicyRuleTarget
-from ._models_py3 import UserSet
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import ApprovalMode
-from ._authorization_management_client_enums import EnablementRules
-from ._authorization_management_client_enums import NotificationDeliveryMechanism
-from ._authorization_management_client_enums import NotificationLevel
-from ._authorization_management_client_enums import RecipientType
-from ._authorization_management_client_enums import RoleManagementPolicyRuleType
-from ._authorization_management_client_enums import UserType
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ ApprovalSettings,
+ ApprovalStage,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ Permission,
+ PermissionGetResult,
+ Principal,
+ RoleDefinition,
+ RoleDefinitionFilter,
+ RoleDefinitionListResult,
+ RoleManagementPolicyApprovalRule,
+ RoleManagementPolicyAuthenticationContextRule,
+ RoleManagementPolicyEnablementRule,
+ RoleManagementPolicyExpirationRule,
+ RoleManagementPolicyNotificationRule,
+ RoleManagementPolicyRule,
+ RoleManagementPolicyRuleTarget,
+ UserSet,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ ApprovalMode,
+ EnablementRules,
+ NotificationDeliveryMechanism,
+ NotificationLevel,
+ RecipientType,
+ RoleManagementPolicyRuleType,
+ UserType,
+)
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__ = [
@@ -65,5 +76,5 @@
"RoleManagementPolicyRuleType",
"UserType",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_models_py3.py
index dbd980877d8d..6aa59334d632 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_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.
@@ -12,7 +12,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -379,7 +378,7 @@ def __init__(
self.email = email
-class RoleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class RoleDefinition(_serialization.Model):
"""Role definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -534,7 +533,7 @@ class RoleManagementPolicyRule(_serialization.Model):
RoleManagementPolicyEnablementRule, RoleManagementPolicyExpirationRule,
RoleManagementPolicyNotificationRule
- 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: The id of the rule.
:vartype id: str
@@ -592,7 +591,7 @@ def __init__(
class RoleManagementPolicyApprovalRule(RoleManagementPolicyRule):
"""The role management policy approval rule.
- 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: The id of the rule.
:vartype id: str
@@ -642,10 +641,10 @@ def __init__(
self.setting = setting
-class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule):
+class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule): # pylint: disable=name-too-long
"""The role management policy authentication context rule.
- 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: The id of the rule.
:vartype id: str
@@ -705,7 +704,7 @@ def __init__(
class RoleManagementPolicyEnablementRule(RoleManagementPolicyRule):
"""The role management policy enablement rule.
- 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: The id of the rule.
:vartype id: str
@@ -760,7 +759,7 @@ def __init__(
class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule):
"""The role management policy expiration rule.
- 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: The id of the rule.
:vartype id: str
@@ -820,7 +819,7 @@ def __init__(
class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule):
"""The role management policy notification rule.
- 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: The id of the rule.
:vartype id: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/__init__.py
index 10fe5b64a01c..fbf230bef908 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_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 ._permissions_operations import PermissionsOperations
-from ._role_definitions_operations import RoleDefinitionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._permissions_operations import PermissionsOperations # type: ignore
+from ._role_definitions_operations import RoleDefinitionsOperations # 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__ = [
"PermissionsOperations",
"RoleDefinitionsOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_permissions_operations.py
index bbebc9f28537..515efb3490fa 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_permissions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_permissions_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, _format_url_section
+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]]
@@ -55,7 +57,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -99,7 +101,7 @@ def build_list_for_resource_request(
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -137,7 +139,6 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
: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 Permission or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission]
@@ -151,7 +152,7 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -162,16 +163,14 @@ def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> It
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_group_request(
+ _request = build_list_for_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_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
@@ -182,14 +181,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("PermissionGetResult", pipeline_response)
@@ -199,11 +197,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
@@ -216,10 +214,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions"
- }
-
@distributed_trace
def list_for_resource(
self,
@@ -243,7 +237,6 @@ def list_for_resource(
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for. Required.
:type resource_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Permission or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission]
@@ -257,7 +250,7 @@ def list_for_resource(
)
cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -268,7 +261,7 @@ def list_for_resource(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_resource_request(
+ _request = build_list_for_resource_request(
resource_group_name=resource_group_name,
resource_provider_namespace=resource_provider_namespace,
parent_resource_path=parent_resource_path,
@@ -276,12 +269,10 @@ def prepare_request(next_link=None):
resource_name=resource_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_for_resource.metadata["url"],
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
@@ -292,14 +283,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("PermissionGetResult", pipeline_response)
@@ -309,11 +299,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
@@ -325,7 +315,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_resource.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions"
- }
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_role_definitions_operations.py
index f214db91e563..cf1dbf48c706 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_role_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_role_definitions_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, _format_url_section
+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]]
@@ -51,7 +53,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) ->
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,7 +78,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -102,7 +104,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs
"roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -128,7 +130,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
if filter is not None:
@@ -154,7 +156,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest:
"roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -187,6 +189,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional[_models.RoleDefinition]:
+ # pylint: disable=line-too-long
"""Deletes a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -197,12 +200,11 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
:type scope: str
:param role_definition_id: The ID of the role definition to delete. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or None or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -218,20 +220,18 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
)
cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
scope=scope,
role_definition_id=role_definition_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
@@ -243,17 +243,16 @@ def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional
deserialized = None
if response.status_code == 200:
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Get role definition by ID (GUID).
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -264,12 +263,11 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
:type scope: str
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -285,20 +283,18 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
role_definition_id=role_definition_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
@@ -308,14 +304,12 @@ def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.Rol
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -327,6 +321,7 @@ def create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Creates or updates a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -342,7 +337,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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -353,11 +347,12 @@ def create_or_update(
self,
scope: str,
role_definition_id: str,
- role_definition: IO,
+ role_definition: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Creates or updates a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -369,11 +364,10 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Required.
- :type role_definition: IO
+ :type role_definition: 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: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
@@ -381,8 +375,13 @@ def create_or_update(
@distributed_trace
def create_or_update(
- self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any
+ self,
+ scope: str,
+ role_definition_id: str,
+ role_definition: Union[_models.RoleDefinition, IO[bytes]],
+ **kwargs: Any
) -> _models.RoleDefinition:
+ # pylint: disable=line-too-long
"""Creates or updates a role definition.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -394,18 +393,14 @@ def create_or_update(
:param role_definition_id: The ID of the role definition. Required.
:type role_definition_id: str
:param role_definition: The values for the role definition. Is either a RoleDefinition type or
- a IO type. Required.
+ a IO[bytes] type. Required.
:type role_definition: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -430,23 +425,21 @@ def create_or_update(
else:
_json = self._serialize.body(role_definition, "RoleDefinition")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
scope=scope,
role_definition_id=role_definition_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -456,17 +449,16 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"}
+ return deserialized # type: ignore
@distributed_trace
def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]:
+ # pylint: disable=line-too-long
"""Get all role definitions that are applicable at scope and above.
:param scope: The scope of the operation or resource. Valid scopes are: subscription (format:
@@ -478,7 +470,6 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
:param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below
the given scope as well. Default value is None.
:type filter: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RoleDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition]
@@ -492,7 +483,7 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
)
cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,16 +494,14 @@ def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Itera
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
scope=scope,
filter=filter,
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
@@ -523,14 +512,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("RoleDefinitionListResult", pipeline_response)
@@ -540,11 +528,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
@@ -557,8 +545,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"}
-
@distributed_trace
def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
"""Gets a role definition by ID.
@@ -569,12 +555,11 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role
definitions. Required.
:type role_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: RoleDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -590,19 +575,17 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
)
cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None)
- request = build_get_by_id_request(
+ _request = build_get_by_id_request(
role_id=role_id,
api_version=api_version,
- template_url=self.get_by_id.metadata["url"],
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
@@ -612,11 +595,9 @@ def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("RoleDefinition", pipeline_response)
+ deserialized = self._deserialize("RoleDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_by_id.metadata = {"url": "/{roleId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/__init__.py
index 019f2f208c14..b493190a580c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_authorization_management_client.py
index b1dfd0af0d72..90f43bf4b12c 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -62,7 +64,25 @@ def __init__(
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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)
@@ -84,7 +104,7 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-08-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
@@ -104,12 +124,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) -> "AuthorizationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_configuration.py
index 033d7e5798b5..7f7d4b32ad5a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-08-01-preview")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_metadata.json
index 53b46ccb1488..6326913a0105 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_metadata.json
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._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\": [\"AuthorizationManagementClientConfiguration\"], \".._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\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -88,8 +88,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": {
"alerts": "AlertsOperations",
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +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 typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_version.py
index 77f53a3589c6..e5754a47ce68 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_version.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "4.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/__init__.py
index a6e41513a3c6..ec3fdce8fdae 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_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 ._authorization_management_client import AuthorizationManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._authorization_management_client import AuthorizationManagementClient # 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__ = [
"AuthorizationManagementClient",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_authorization_management_client.py
index ea3406cd35a0..6b41ef8bdaee 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_authorization_management_client.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_authorization_management_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 AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class AuthorizationManagementClient:
"""Role based access control provides you a way to apply granular level policy administration down
to individual resources or resource groups. These operations enable you to manage role
assignments. A role assignment grants access to Azure Active Directory users.
@@ -62,7 +64,25 @@ def __init__(
self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
) -> None:
self._config = AuthorizationManagementClientConfiguration(credential=credential, **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)
@@ -84,7 +104,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize, "2022-08-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
@@ -104,12 +126,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) -> "AuthorizationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_configuration.py
index 278d20daec1f..5754af06f6b1 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_configuration.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_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 AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AuthorizationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AuthorizationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,7 +31,6 @@ class AuthorizationManagementClientConfiguration(Configuration): # pylint: disa
"""
def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
- super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2022-08-01-preview")
if credential is None:
@@ -43,6 +40,7 @@ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None:
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +49,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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/__init__.py
index f755caaa9c2a..523c33cbd5f8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_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 ._alerts_operations import AlertsOperations
-from ._alert_configurations_operations import AlertConfigurationsOperations
-from ._alert_definitions_operations import AlertDefinitionsOperations
-from ._alert_incidents_operations import AlertIncidentsOperations
-from ._alert_operation_operations import AlertOperationOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._alerts_operations import AlertsOperations # type: ignore
+from ._alert_configurations_operations import AlertConfigurationsOperations # type: ignore
+from ._alert_definitions_operations import AlertDefinitionsOperations # type: ignore
+from ._alert_incidents_operations import AlertIncidentsOperations # type: ignore
+from ._alert_operation_operations import AlertOperationOperations # 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 @@
"AlertIncidentsOperations",
"AlertOperationOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_configurations_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_configurations_operations.py
index d9f81bb3f78b..3bb44c195758 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_configurations_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_configurations_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,21 +20,23 @@
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._alert_configurations_operations import (
build_get_request,
build_list_for_scope_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]]
@@ -61,6 +63,7 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace_async
async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfiguration:
+ # pylint: disable=line-too-long
"""Get the specified alert configuration.
:param scope: The scope of the alert configuration. The scope can be any REST resource
@@ -73,12 +76,11 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertCo
:type scope: str
:param alert_id: The name of the alert configuration to get. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -94,20 +96,18 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertCo
)
cls: ClsType[_models.AlertConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_id=alert_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
@@ -116,17 +116,15 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertCo
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertConfiguration", pipeline_response)
+ deserialized = self._deserialize("AlertConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"}
+ return deserialized # type: ignore
@overload
- async def update( # pylint: disable=inconsistent-return-statements
+ async def update(
self,
scope: str,
alert_id: str,
@@ -146,15 +144,14 @@ async def update( # pylint: disable=inconsistent-return-statements
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: 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:
"""
@overload
- async def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ async def update(
+ self, scope: str, alert_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> None:
"""Update an alert configuration.
@@ -163,19 +160,18 @@ async def update( # pylint: disable=inconsistent-return-statements
:param alert_id: The name of the alert configuration to update. Required.
:type alert_id: str
:param parameters: Parameters for the alert configuration. 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: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
- async def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO], **kwargs: Any
+ async def update(
+ self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO[bytes]], **kwargs: Any
) -> None:
"""Update an alert configuration.
@@ -184,17 +180,14 @@ async def update( # pylint: disable=inconsistent-return-statements
:param alert_id: The name of the alert configuration to update. Required.
:type alert_id: str
:param parameters: Parameters for the alert configuration. Is either a AlertConfiguration type
- or a IO type. Required.
- :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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 a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration or
+ IO[bytes]
: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,
@@ -219,23 +212,21 @@ async def update( # pylint: disable=inconsistent-return-statements
else:
_json = self._serialize.body(parameters, "AlertConfiguration")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -245,17 +236,15 @@ async def update( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"}
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.AlertConfiguration"]:
+ # pylint: disable=line-too-long
"""Gets alert configurations for a resource scope.
:param scope: The scope of the alert configuration. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AlertConfiguration or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration]
@@ -269,7 +258,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
)
cls: ClsType[_models.AlertConfigurationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -280,15 +269,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -299,14 +286,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("AlertConfigurationListResult", pipeline_response)
@@ -316,11 +302,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
@@ -331,5 +317,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_definitions_operations.py
index 2b61202b6850..8d2e558c2542 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_definitions_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._alert_definitions_operations import build_get_request, build_list_for_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]]
@@ -56,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace_async
async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.AlertDefinition:
+ # pylint: disable=line-too-long
"""Get the specified alert definition.
:param scope: The scope of the alert definition. The scope can be any REST resource instance.
@@ -68,12 +71,11 @@ async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _mod
:type scope: str
:param alert_definition_id: The name of the alert definition to get. Required.
:type alert_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -89,20 +91,18 @@ async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _mod
)
cls: ClsType[_models.AlertDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_definition_id=alert_definition_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
@@ -111,16 +111,12 @@ async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _mod
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertDefinition", pipeline_response)
+ deserialized = self._deserialize("AlertDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.AlertDefinition"]:
@@ -128,7 +124,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
:param scope: The scope of the alert definition. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AlertDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition]
@@ -142,7 +137,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
)
cls: ClsType[_models.AlertDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -153,15 +148,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -172,14 +165,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("AlertDefinitionListResult", pipeline_response)
@@ -189,11 +181,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
@@ -204,5 +196,3 @@ async def get_next(next_link=None):
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_incidents_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_incidents_operations.py
index 8d81b33abf64..039447af9f9a 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_incidents_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_incidents_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,21 +19,23 @@
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._alert_incidents_operations import (
build_get_request,
build_list_for_scope_request,
build_remediate_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]]
@@ -60,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace_async
async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) -> _models.AlertIncident:
+ # pylint: disable=line-too-long
"""Get the specified alert incident.
:param scope: The scope of the alert incident. The scope can be any REST resource instance. For
@@ -74,12 +77,11 @@ async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs:
:type alert_id: str
:param alert_incident_id: The name of the alert incident to get. Required.
:type alert_incident_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertIncident or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,21 +97,19 @@ async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs:
)
cls: ClsType[_models.AlertIncident] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_id=alert_id,
alert_incident_id=alert_incident_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
@@ -118,16 +118,12 @@ async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertIncident", pipeline_response)
+ deserialized = self._deserialize("AlertIncident", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncIterable["_models.AlertIncident"]:
@@ -137,7 +133,6 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncItera
:type scope: str
:param alert_id: The name of the alert. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AlertIncident or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident]
@@ -151,7 +146,7 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncItera
)
cls: ClsType[_models.AlertIncidentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -162,16 +157,14 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncItera
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -182,14 +175,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("AlertIncidentListResult", pipeline_response)
@@ -199,11 +191,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
@@ -215,14 +207,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents"
- }
-
@distributed_trace_async
- async def remediate( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any
- ) -> None:
+ async def remediate(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) -> None:
"""Remediate an alert incident.
:param scope: The scope of the alert incident. Required.
@@ -231,12 +217,11 @@ async def remediate( # pylint: disable=inconsistent-return-statements
:type alert_id: str
:param alert_incident_id: The name of the alert incident to remediate. Required.
:type alert_incident_id: 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,
@@ -252,21 +237,19 @@ async def remediate( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_remediate_request(
+ _request = build_remediate_request(
scope=scope,
alert_id=alert_id,
alert_incident_id=alert_incident_id,
api_version=api_version,
- template_url=self.remediate.metadata["url"],
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
@@ -276,8 +259,4 @@ async def remediate( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- remediate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_operation_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_operation_operations.py
index 66abb7247b37..1876902ad9c5 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_operation_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_operation_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._alert_operation_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]]
@@ -59,12 +61,11 @@ async def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.Ale
:type scope: str
:param operation_id: The id of the alert operation. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertOperationResult or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -80,20 +81,18 @@ async def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.Ale
)
cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
operation_id=operation_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
@@ -102,11 +101,9 @@ async def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.Ale
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = self._deserialize("AlertOperationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alerts_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alerts_operations.py
index 309ec8b6fca5..9eda82753e39 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alerts_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alerts_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._alerts_operations import (
build_get_request,
build_list_for_scope_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]]
@@ -65,6 +69,7 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace_async
async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
+ # pylint: disable=line-too-long
"""Get the specified alert.
:param scope: The scope of the alert. The scope can be any REST resource instance. For example,
@@ -76,12 +81,11 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
:type scope: str
:param alert_id: The name of the alert to get. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Alert or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -97,20 +101,18 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
)
cls: ClsType[_models.Alert] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_id=alert_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
@@ -119,17 +121,15 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Alert", pipeline_response)
+ deserialized = self._deserialize("Alert", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"}
+ return deserialized # type: ignore
@overload
- async def update( # pylint: disable=inconsistent-return-statements
+ async def update(
self,
scope: str,
alert_id: str,
@@ -149,15 +149,14 @@ async def update( # pylint: disable=inconsistent-return-statements
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: 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:
"""
@overload
- async def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ async def update(
+ self, scope: str, alert_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> None:
"""Update an alert.
@@ -166,19 +165,18 @@ async def update( # pylint: disable=inconsistent-return-statements
:param alert_id: The name of the alert to dismiss. Required.
:type alert_id: str
:param parameters: Parameters for the alert. 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: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
- async def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO], **kwargs: Any
+ async def update(
+ self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO[bytes]], **kwargs: Any
) -> None:
"""Update an alert.
@@ -186,17 +184,14 @@ async def update( # pylint: disable=inconsistent-return-statements
:type scope: str
:param alert_id: The name of the alert to dismiss. Required.
:type alert_id: str
- :param parameters: Parameters for the alert. Is either a Alert type or a IO type. Required.
- :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ :param parameters: Parameters for the alert. Is either a Alert type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert or IO[bytes]
: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,
@@ -221,23 +216,21 @@ async def update( # pylint: disable=inconsistent-return-statements
else:
_json = self._serialize.body(parameters, "Alert")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -247,9 +240,7 @@ async def update( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"}
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]:
@@ -257,7 +248,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
:param scope: The scope of the alert. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Alert or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.Alert]
@@ -271,7 +261,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
)
cls: ClsType[_models.AlertListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -282,15 +272,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Al
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -301,14 +289,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("AlertListResult", pipeline_response)
@@ -318,11 +305,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
@@ -334,10 +321,8 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts"}
-
- async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertOperationResult:
- error_map = {
+ async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -351,43 +336,42 @@ async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _m
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview")
)
- cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_refresh_request(
+ _request = build_refresh_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
- template_url=self._refresh_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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
-
- return deserialized
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- _refresh_initial.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_refresh(
@@ -399,14 +383,6 @@ async def begin_refresh(
:type scope: str
:param alert_id: The name of the alert to refresh. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either AlertOperationResult or the result
of cls(response)
:rtype:
@@ -433,6 +409,7 @@ async def begin_refresh(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -440,9 +417,9 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = self._deserialize("AlertOperationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
if polling is True:
@@ -454,20 +431,18 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.AlertOperationResult].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_refresh.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh"
- }
+ return AsyncLROPoller[_models.AlertOperationResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperationResult:
- error_map = {
+ async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -481,40 +456,41 @@ async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.Alert
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview")
)
- cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_refresh_all_request(
+ _request = build_refresh_all_request(
scope=scope,
api_version=api_version,
- template_url=self._refresh_all_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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- return deserialized
-
- _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"}
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_refresh_all(self, scope: str, **kwargs: Any) -> AsyncLROPoller[_models.AlertOperationResult]:
@@ -522,14 +498,6 @@ async def begin_refresh_all(self, scope: str, **kwargs: Any) -> AsyncLROPoller[_
:param scope: The scope of the alert. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either AlertOperationResult or the result
of cls(response)
:rtype:
@@ -550,6 +518,7 @@ async def begin_refresh_all(self, scope: str, **kwargs: Any) -> AsyncLROPoller[_
raw_result = await self._refresh_all_initial(
scope=scope, 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):
@@ -557,9 +526,9 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = self._deserialize("AlertOperationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
if polling is True:
@@ -571,12 +540,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.AlertOperationResult].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_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"}
+ return AsyncLROPoller[_models.AlertOperationResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/__init__.py
index 96b97b97e7c8..58d14d7f3082 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/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 Alert
-from ._models_py3 import AlertConfiguration
-from ._models_py3 import AlertConfigurationListResult
-from ._models_py3 import AlertConfigurationProperties
-from ._models_py3 import AlertDefinition
-from ._models_py3 import AlertDefinitionListResult
-from ._models_py3 import AlertIncident
-from ._models_py3 import AlertIncidentListResult
-from ._models_py3 import AlertIncidentProperties
-from ._models_py3 import AlertListResult
-from ._models_py3 import AlertOperationResult
-from ._models_py3 import AzureRolesAssignedOutsidePimAlertConfigurationProperties
-from ._models_py3 import AzureRolesAssignedOutsidePimAlertIncidentProperties
-from ._models_py3 import CloudErrorBody
-from ._models_py3 import DuplicateRoleCreatedAlertConfigurationProperties
-from ._models_py3 import DuplicateRoleCreatedAlertIncidentProperties
-from ._models_py3 import TooManyOwnersAssignedToResourceAlertConfigurationProperties
-from ._models_py3 import TooManyOwnersAssignedToResourceAlertIncidentProperties
-from ._models_py3 import TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties
-from ._models_py3 import TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties
+from typing import TYPE_CHECKING
-from ._authorization_management_client_enums import SeverityLevel
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ Alert,
+ AlertConfiguration,
+ AlertConfigurationListResult,
+ AlertConfigurationProperties,
+ AlertDefinition,
+ AlertDefinitionListResult,
+ AlertIncident,
+ AlertIncidentListResult,
+ AlertIncidentProperties,
+ AlertListResult,
+ AlertOperationResult,
+ AzureRolesAssignedOutsidePimAlertConfigurationProperties,
+ AzureRolesAssignedOutsidePimAlertIncidentProperties,
+ CloudErrorBody,
+ DuplicateRoleCreatedAlertConfigurationProperties,
+ DuplicateRoleCreatedAlertIncidentProperties,
+ TooManyOwnersAssignedToResourceAlertConfigurationProperties,
+ TooManyOwnersAssignedToResourceAlertIncidentProperties,
+ TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties,
+ TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties,
+)
+
+from ._authorization_management_client_enums import ( # type: ignore
+ SeverityLevel,
+)
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 @@
"TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties",
"SeverityLevel",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_models_py3.py
index ba2f22ba8cb7..8ac9d6d670eb 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_models_py3.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_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.
@@ -12,11 +11,10 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
-class Alert(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class Alert(_serialization.Model):
"""The alert.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -198,7 +196,7 @@ class AlertConfigurationProperties(_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 alert_definition_id: The alert definition ID.
:vartype alert_definition_id: str
@@ -251,7 +249,7 @@ def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None:
self.alert_definition = None
-class AlertDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class AlertDefinition(_serialization.Model):
"""Alert definition.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -433,7 +431,7 @@ class AlertIncidentProperties(_serialization.Model):
TooManyOwnersAssignedToResourceAlertIncidentProperties,
TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties
- 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 alert_incident_type: The alert incident type. Required.
:vartype alert_incident_type: str
@@ -538,12 +536,14 @@ def __init__(self, **kwargs: Any) -> None:
self.resource_location = None
-class AzureRolesAssignedOutsidePimAlertConfigurationProperties(AlertConfigurationProperties):
+class AzureRolesAssignedOutsidePimAlertConfigurationProperties(
+ AlertConfigurationProperties
+): # pylint: disable=name-too-long
"""The Azure roles assigned outside PIM alert configuration properties.
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 alert_definition_id: The alert definition ID.
:vartype alert_definition_id: str
@@ -583,14 +583,12 @@ def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None:
self.alert_configuration_type: str = "AzureRolesAssignedOutsidePimAlertConfiguration"
-class AzureRolesAssignedOutsidePimAlertIncidentProperties(
- AlertIncidentProperties
-): # pylint: disable=too-many-instance-attributes
+class AzureRolesAssignedOutsidePimAlertIncidentProperties(AlertIncidentProperties): # pylint: disable=name-too-long
"""Azure roles assigned outside PIM alert incident properties.
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 alert_incident_type: The alert incident type. Required.
:vartype alert_incident_type: str
@@ -690,12 +688,12 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None,
self.message = message
-class DuplicateRoleCreatedAlertConfigurationProperties(AlertConfigurationProperties):
+class DuplicateRoleCreatedAlertConfigurationProperties(AlertConfigurationProperties): # pylint: disable=name-too-long
"""The duplicate role created alert configuration.
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 alert_definition_id: The alert definition ID.
:vartype alert_definition_id: str
@@ -735,12 +733,12 @@ def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None:
self.alert_configuration_type: str = "DuplicateRoleCreatedAlertConfiguration"
-class DuplicateRoleCreatedAlertIncidentProperties(AlertIncidentProperties):
+class DuplicateRoleCreatedAlertIncidentProperties(AlertIncidentProperties): # pylint: disable=name-too-long
"""Duplicate role created alert incident properties.
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 alert_incident_type: The alert incident type. Required.
:vartype alert_incident_type: str
@@ -775,12 +773,14 @@ def __init__(self, **kwargs: Any) -> None:
self.reason = None
-class TooManyOwnersAssignedToResourceAlertConfigurationProperties(AlertConfigurationProperties):
+class TooManyOwnersAssignedToResourceAlertConfigurationProperties(
+ AlertConfigurationProperties
+): # pylint: disable=name-too-long
"""Too many owners assigned to resource alert configuration properties.
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 alert_definition_id: The alert definition ID.
:vartype alert_definition_id: str
@@ -846,12 +846,12 @@ def __init__(
)
-class TooManyOwnersAssignedToResourceAlertIncidentProperties(AlertIncidentProperties):
+class TooManyOwnersAssignedToResourceAlertIncidentProperties(AlertIncidentProperties): # pylint: disable=name-too-long
"""Too many owners assigned to resource alert incident properties.
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 alert_incident_type: The alert incident type. Required.
:vartype alert_incident_type: str
@@ -881,12 +881,14 @@ def __init__(self, **kwargs: Any) -> None:
self.assignee_type = None
-class TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties(AlertConfigurationProperties):
+class TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties(
+ AlertConfigurationProperties
+): # pylint: disable=name-too-long
"""Too many permanent owners assigned to resource alert configuration properties.
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 alert_definition_id: The alert definition ID.
:vartype alert_definition_id: str
@@ -952,12 +954,14 @@ def __init__(
)
-class TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties(AlertIncidentProperties):
+class TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties(
+ AlertIncidentProperties
+): # pylint: disable=name-too-long
"""Too many permanent owners assigned to resource alert incident properties.
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 alert_incident_type: The alert incident type. Required.
:vartype alert_incident_type: str
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/__init__.py
index f755caaa9c2a..523c33cbd5f8 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/__init__.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_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 ._alerts_operations import AlertsOperations
-from ._alert_configurations_operations import AlertConfigurationsOperations
-from ._alert_definitions_operations import AlertDefinitionsOperations
-from ._alert_incidents_operations import AlertIncidentsOperations
-from ._alert_operation_operations import AlertOperationOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._alerts_operations import AlertsOperations # type: ignore
+from ._alert_configurations_operations import AlertConfigurationsOperations # type: ignore
+from ._alert_definitions_operations import AlertDefinitionsOperations # type: ignore
+from ._alert_incidents_operations import AlertIncidentsOperations # type: ignore
+from ._alert_operation_operations import AlertOperationOperations # 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 @@
"AlertIncidentsOperations",
"AlertOperationOperations",
]
-__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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_configurations_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_configurations_operations.py
index 5685979c2f3e..7d65f4a30c49 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_configurations_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_configurations_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, _format_url_section
+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]]
@@ -53,7 +55,7 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest:
"alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +83,7 @@ def build_update_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReques
"alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -107,7 +109,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -140,6 +142,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfiguration:
+ # pylint: disable=line-too-long
"""Get the specified alert configuration.
:param scope: The scope of the alert configuration. The scope can be any REST resource
@@ -152,12 +155,11 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfigur
:type scope: str
:param alert_id: The name of the alert configuration to get. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertConfiguration or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,20 +175,18 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfigur
)
cls: ClsType[_models.AlertConfiguration] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_id=alert_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
@@ -195,17 +195,15 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfigur
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertConfiguration", pipeline_response)
+ deserialized = self._deserialize("AlertConfiguration", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"}
+ return deserialized # type: ignore
@overload
- def update( # pylint: disable=inconsistent-return-statements
+ def update(
self,
scope: str,
alert_id: str,
@@ -225,15 +223,14 @@ def update( # pylint: disable=inconsistent-return-statements
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: 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:
"""
@overload
- def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ def update(
+ self, scope: str, alert_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> None:
"""Update an alert configuration.
@@ -242,11 +239,10 @@ def update( # pylint: disable=inconsistent-return-statements
:param alert_id: The name of the alert configuration to update. Required.
:type alert_id: str
:param parameters: Parameters for the alert configuration. 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: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -254,7 +250,7 @@ def update( # pylint: disable=inconsistent-return-statements
@distributed_trace
def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO], **kwargs: Any
+ self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO[bytes]], **kwargs: Any
) -> None:
"""Update an alert configuration.
@@ -263,17 +259,14 @@ def update( # pylint: disable=inconsistent-return-statements
:param alert_id: The name of the alert configuration to update. Required.
:type alert_id: str
:param parameters: Parameters for the alert configuration. Is either a AlertConfiguration type
- or a IO type. Required.
- :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/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 a IO[bytes] type. Required.
+ :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration or
+ IO[bytes]
: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,
@@ -298,23 +291,21 @@ def update( # pylint: disable=inconsistent-return-statements
else:
_json = self._serialize.body(parameters, "AlertConfiguration")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -324,9 +315,7 @@ def update( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"}
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertConfiguration"]:
@@ -334,7 +323,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertCo
:param scope: The scope of the alert configuration. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AlertConfiguration or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration]
@@ -348,7 +336,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertCo
)
cls: ClsType[_models.AlertConfigurationListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -359,15 +347,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertCo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -378,14 +364,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("AlertConfigurationListResult", pipeline_response)
@@ -395,11 +380,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
@@ -410,5 +395,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_definitions_operations.py
index c6975619eab0..128419522ceb 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_definitions_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_definitions_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, _format_url_section
+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]]
@@ -52,7 +54,7 @@ def build_get_request(scope: str, alert_definition_id: str, **kwargs: Any) -> Ht
"alertDefinitionId": _SERIALIZER.url("alert_definition_id", alert_definition_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,7 +78,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -109,6 +111,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.AlertDefinition:
+ # pylint: disable=line-too-long
"""Get the specified alert definition.
:param scope: The scope of the alert definition. The scope can be any REST resource instance.
@@ -121,12 +124,11 @@ def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.Al
:type scope: str
:param alert_definition_id: The name of the alert definition to get. Required.
:type alert_definition_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertDefinition or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -142,20 +144,18 @@ def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.Al
)
cls: ClsType[_models.AlertDefinition] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_definition_id=alert_definition_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
@@ -164,16 +164,12 @@ def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.Al
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertDefinition", pipeline_response)
+ deserialized = self._deserialize("AlertDefinition", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertDefinition"]:
@@ -181,7 +177,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertDe
:param scope: The scope of the alert definition. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AlertDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition]
@@ -195,7 +190,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertDe
)
cls: ClsType[_models.AlertDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -206,15 +201,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertDe
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -225,14 +218,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("AlertDefinitionListResult", pipeline_response)
@@ -242,11 +234,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
@@ -257,5 +249,3 @@ def get_next(next_link=None):
return pipeline_response
return ItemPaged(get_next, extract_data)
-
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions"}
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_incidents_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_incidents_operations.py
index 3b5931f1527a..f01d72318c9f 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_incidents_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_incidents_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, _format_url_section
+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]]
@@ -54,7 +56,7 @@ def build_get_request(scope: str, alert_id: str, alert_incident_id: str, **kwarg
"alertIncidentId": _SERIALIZER.url("alert_incident_id", alert_incident_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +83,7 @@ def build_list_for_scope_request(scope: str, alert_id: str, **kwargs: Any) -> Ht
"alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -110,7 +112,7 @@ def build_remediate_request(scope: str, alert_id: str, alert_incident_id: str, *
"alertIncidentId": _SERIALIZER.url("alert_incident_id", alert_incident_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -143,6 +145,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) -> _models.AlertIncident:
+ # pylint: disable=line-too-long
"""Get the specified alert incident.
:param scope: The scope of the alert incident. The scope can be any REST resource instance. For
@@ -157,12 +160,11 @@ def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any)
:type alert_id: str
:param alert_incident_id: The name of the alert incident to get. Required.
:type alert_incident_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertIncident or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -178,21 +180,19 @@ def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any)
)
cls: ClsType[_models.AlertIncident] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_id=alert_id,
alert_incident_id=alert_incident_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
@@ -201,16 +201,12 @@ def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertIncident", pipeline_response)
+ deserialized = self._deserialize("AlertIncident", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> Iterable["_models.AlertIncident"]:
@@ -220,7 +216,6 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> Iterable["
:type scope: str
:param alert_id: The name of the alert. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AlertIncident or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident]
@@ -234,7 +229,7 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> Iterable["
)
cls: ClsType[_models.AlertIncidentListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -245,16 +240,14 @@ def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> Iterable["
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -265,14 +258,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("AlertIncidentListResult", pipeline_response)
@@ -282,11 +274,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
@@ -298,10 +290,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents"
- }
-
@distributed_trace
def remediate( # pylint: disable=inconsistent-return-statements
self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any
@@ -314,12 +302,11 @@ def remediate( # pylint: disable=inconsistent-return-statements
:type alert_id: str
:param alert_incident_id: The name of the alert incident to remediate. Required.
:type alert_incident_id: 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,
@@ -335,21 +322,19 @@ def remediate( # pylint: disable=inconsistent-return-statements
)
cls: ClsType[None] = kwargs.pop("cls", None)
- request = build_remediate_request(
+ _request = build_remediate_request(
scope=scope,
alert_id=alert_id,
alert_incident_id=alert_incident_id,
api_version=api_version,
- template_url=self.remediate.metadata["url"],
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
@@ -359,8 +344,4 @@ def remediate( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- remediate.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate"
- }
+ return cls(pipeline_response, None, {}) # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_operation_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_operation_operations.py
index 6677021599f0..35d1f6de8fa9 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_operation_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_operation_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, _format_url_section
+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]]
@@ -50,7 +52,7 @@ def build_get_request(scope: str, operation_id: str, **kwargs: Any) -> HttpReque
"operationId": _SERIALIZER.url("operation_id", operation_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,12 +91,11 @@ def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOper
:type scope: str
:param operation_id: The id of the alert operation. Required.
:type operation_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: AlertOperationResult or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -110,20 +111,18 @@ def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOper
)
cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
operation_id=operation_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
@@ -132,11 +131,9 @@ def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOper
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = self._deserialize("AlertOperationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}"}
+ return deserialized # type: ignore
diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alerts_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alerts_operations.py
index 04c84dc29506..1b3a18e87b05 100644
--- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alerts_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alerts_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, _format_url_section
+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]]
@@ -53,7 +57,7 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest:
"alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,7 +83,7 @@ def build_update_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReques
"alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -105,7 +109,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -132,7 +136,7 @@ def build_refresh_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReque
"alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -156,7 +160,7 @@ def build_refresh_all_request(scope: str, **kwargs: Any) -> HttpRequest:
"scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -189,6 +193,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
+ # pylint: disable=line-too-long
"""Get the specified alert.
:param scope: The scope of the alert. The scope can be any REST resource instance. For example,
@@ -200,12 +205,11 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
:type scope: str
:param alert_id: The name of the alert to get. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Alert or the result of cls(response)
:rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -221,20 +225,18 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
)
cls: ClsType[_models.Alert] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
scope=scope,
alert_id=alert_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
@@ -243,17 +245,15 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Alert", pipeline_response)
+ deserialized = self._deserialize("Alert", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"}
+ return deserialized # type: ignore
@overload
- def update( # pylint: disable=inconsistent-return-statements
+ def update(
self,
scope: str,
alert_id: str,
@@ -273,15 +273,14 @@ def update( # pylint: disable=inconsistent-return-statements
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: 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:
"""
@overload
- def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ def update(
+ self, scope: str, alert_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> None:
"""Update an alert.
@@ -290,11 +289,10 @@ def update( # pylint: disable=inconsistent-return-statements
:param alert_id: The name of the alert to dismiss. Required.
:type alert_id: str
:param parameters: Parameters for the alert. 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: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
@@ -302,7 +300,7 @@ def update( # pylint: disable=inconsistent-return-statements
@distributed_trace
def update( # pylint: disable=inconsistent-return-statements
- self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO], **kwargs: Any
+ self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO[bytes]], **kwargs: Any
) -> None:
"""Update an alert.
@@ -310,17 +308,14 @@ def update( # pylint: disable=inconsistent-return-statements
:type scope: str
:param alert_id: The name of the alert to dismiss. Required.
:type alert_id: str
- :param parameters: Parameters for the alert. Is either a Alert type or a IO type. Required.
- :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ :param parameters: Parameters for the alert. Is either a Alert type or a IO[bytes] type.
+ Required.
+ :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert or IO[bytes]
: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,
@@ -345,23 +340,21 @@ def update( # pylint: disable=inconsistent-return-statements
else:
_json = self._serialize.body(parameters, "Alert")
- request = build_update_request(
+ _request = build_update_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -371,9 +364,7 @@ def update( # pylint: disable=inconsistent-return-statements
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
- return cls(pipeline_response, None, {})
-
- update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"}
+ return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace
def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.Alert"]:
@@ -381,7 +372,6 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.Alert"]
:param scope: The scope of the alert. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Alert or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.Alert]
@@ -395,7 +385,7 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.Alert"]
)
cls: ClsType[_models.AlertListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -406,15 +396,13 @@ def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.Alert"]
def prepare_request(next_link=None):
if not next_link:
- request = build_list_for_scope_request(
+ _request = build_list_for_scope_request(
scope=scope,
api_version=api_version,
- template_url=self.list_for_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)
else:
# make call to next link with the client's api-version
@@ -425,14 +413,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("AlertListResult", pipeline_response)
@@ -442,11 +429,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
@@ -458,10 +445,8 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts"}
-
- def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertOperationResult:
- error_map = {
+ def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -475,43 +460,42 @@ def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models.
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview")
)
- cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_refresh_request(
+ _request = build_refresh_request(
scope=scope,
alert_id=alert_id,
api_version=api_version,
- template_url=self._refresh_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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
-
- return deserialized
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- _refresh_initial.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_refresh(self, scope: str, alert_id: str, **kwargs: Any) -> LROPoller[_models.AlertOperationResult]:
@@ -521,14 +505,6 @@ def begin_refresh(self, scope: str, alert_id: str, **kwargs: Any) -> LROPoller[_
:type scope: str
:param alert_id: The name of the alert to refresh. Required.
:type alert_id: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either AlertOperationResult or the result of
cls(response)
:rtype:
@@ -555,6 +531,7 @@ def begin_refresh(self, scope: str, alert_id: str, **kwargs: Any) -> LROPoller[_
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
@@ -562,9 +539,9 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = self._deserialize("AlertOperationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
if polling is True:
@@ -576,20 +553,18 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.AlertOperationResult].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_refresh.metadata = {
- "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh"
- }
+ return LROPoller[_models.AlertOperationResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperationResult:
- error_map = {
+ def _refresh_all_initial(self, scope: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -603,40 +578,41 @@ def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperat
api_version: str = kwargs.pop(
"api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview")
)
- cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_refresh_all_request(
+ _request = build_refresh_all_request(
scope=scope,
api_version=api_version,
- template_url=self._refresh_all_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)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
-
- return deserialized
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"}
+ return deserialized # type: ignore
@distributed_trace
def begin_refresh_all(self, scope: str, **kwargs: Any) -> LROPoller[_models.AlertOperationResult]:
@@ -644,14 +620,6 @@ def begin_refresh_all(self, scope: str, **kwargs: Any) -> LROPoller[_models.Aler
:param scope: The scope of the alert. Required.
:type scope: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either AlertOperationResult or the result of
cls(response)
:rtype:
@@ -672,6 +640,7 @@ def begin_refresh_all(self, scope: str, **kwargs: Any) -> LROPoller[_models.Aler
raw_result = self._refresh_all_initial(
scope=scope, 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):
@@ -679,9 +648,9 @@ def get_long_running_output(pipeline_response):
response = pipeline_response.http_response
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("AlertOperationResult", pipeline_response)
+ deserialized = self._deserialize("AlertOperationResult", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
if polling is True:
@@ -693,12 +662,12 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.AlertOperationResult].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_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"}
+ return LROPoller[_models.AlertOperationResult](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/delete_role_definition.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/delete_role_definition.py
index 6b2656137037..e1c79027048e 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/delete_role_definition.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/delete_role_definition.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_deny_assignments.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_deny_assignments.py
index 7cf4c74f39aa..e32efb3268c8 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_deny_assignments.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_deny_assignments.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_provider_operations.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_provider_operations.py
index 8c832da5bdf7..f6b1880483a4 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_provider_operations.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_all_provider_operations.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_id.py
index 8bf0ac555760..45ff58e9474a 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_id.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_id.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_name_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_name_id.py
index 0406575e2e6a..08d90f00e4e6 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_name_id.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_name_id.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_scope.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_scope.py
index 39d6ac8f0b11..d2063e8dc32d 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_scope.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignment_by_scope.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource.py
index 473ed4991a81..424dc03e9b07 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource_group.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource_group.py
index 1250e4947513..1c7be0db6d57 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource_group.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_deny_assignments_for_resource_group.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_permissions.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_permissions.py
index 0b9782cadbff..531ecfa2bb2e 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_permissions.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_permissions.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_provider_operations_rp.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_provider_operations_rp.py
index 7099bb62050d..9a570e314353 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_provider_operations_rp.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_provider_operations_rp.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_resource_permissions.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_resource_permissions.py
index 4e4cb20f687e..d824f3ff7a25 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_resource_permissions.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_resource_permissions.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_at_scope.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_at_scope.py
index 31d5ddb37f83..91cc8a649813 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_at_scope.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_at_scope.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_id.py
index 344bd2f600e6..dc8900124ebd 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_id.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_id.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_name.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_name.py
index e46ca94e24e6..57256c9c9bad 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_name.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/get_role_definition_by_name.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_by_id.py
index 79724354e685..be011d1212e7 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_by_id.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_by_id.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource.py
index b571ac6a53ad..1239eab90c2b 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource_group.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource_group.py
index 0bf104c5c3f6..3c311000d255 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource_group.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_resource_group.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_subscription.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_subscription.py
index 0349481e954e..52b2ac05633f 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_subscription.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_create_for_subscription.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete.py
index 3065d4fd2aa6..bceb363a97c8 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete_by_id.py
index f1d6ec361703..3b9c70fef2b7 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete_by_id.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_delete_by_id.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get.py
index 95346f257c47..180e33171af9 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get_by_id.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get_by_id.py
index e7520e7b690a..c4f49b308601 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get_by_id.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_get_by_id.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource.py
index 10593e632922..facbb6a9e39b 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource_group.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource_group.py
index 03de94e5fed0..370279d8ac3b 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource_group.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_resource_group.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_scope.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_scope.py
index afca98926b25..3991aa6d249b 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_scope.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_scope.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_subscription.py b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_subscription.py
index b83a8d4ffe33..c253d4ca4461 100644
--- a/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_subscription.py
+++ b/sdk/authorization/azure-mgmt-authorization/generated_samples/role_assignments_list_for_subscription.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.authorization import AuthorizationManagementClient
"""
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/conftest.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/conftest.py
new file mode 100644
index 000000000000..f8dde025df99
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/conftest.py
@@ -0,0 +1,43 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+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):
+ authorizationmanagement_subscription_id = os.environ.get(
+ "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
+ )
+ authorizationmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
+ authorizationmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
+ authorizationmanagement_client_secret = os.environ.get(
+ "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=authorizationmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(regex=authorizationmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=authorizationmanagement_client_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(
+ regex=authorizationmanagement_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/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_deny_assignments_operations.py
new file mode 100644
index 000000000000..438cb9e377cf
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_deny_assignments_operations.py
@@ -0,0 +1,89 @@
+# 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.authorization import AuthorizationManagementClient
+
+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 TestAuthorizationManagementDenyAssignmentsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_deny_assignments_list_for_resource(self, resource_group):
+ response = self.client.deny_assignments.list_for_resource(
+ resource_group_name=resource_group.name,
+ resource_provider_namespace="str",
+ parent_resource_path="str",
+ resource_type="str",
+ resource_name="str",
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_deny_assignments_list_for_resource_group(self, resource_group):
+ response = self.client.deny_assignments.list_for_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_deny_assignments_list(self, resource_group):
+ response = self.client.deny_assignments.list(
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_deny_assignments_get(self, resource_group):
+ response = self.client.deny_assignments.get(
+ scope="str",
+ deny_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_deny_assignments_get_by_id(self, resource_group):
+ response = self.client.deny_assignments.get_by_id(
+ deny_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_deny_assignments_list_for_scope(self, resource_group):
+ response = self.client.deny_assignments.list_for_scope(
+ scope="str",
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_deny_assignments_operations_async.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_deny_assignments_operations_async.py
new file mode 100644
index 000000000000..342afc00038a
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_deny_assignments_operations_async.py
@@ -0,0 +1,90 @@
+# 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.authorization.aio import AuthorizationManagementClient
+
+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 TestAuthorizationManagementDenyAssignmentsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_deny_assignments_list_for_resource(self, resource_group):
+ response = self.client.deny_assignments.list_for_resource(
+ resource_group_name=resource_group.name,
+ resource_provider_namespace="str",
+ parent_resource_path="str",
+ resource_type="str",
+ resource_name="str",
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_deny_assignments_list_for_resource_group(self, resource_group):
+ response = self.client.deny_assignments.list_for_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_deny_assignments_list(self, resource_group):
+ response = self.client.deny_assignments.list(
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_deny_assignments_get(self, resource_group):
+ response = await self.client.deny_assignments.get(
+ scope="str",
+ deny_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_deny_assignments_get_by_id(self, resource_group):
+ response = await self.client.deny_assignments.get_by_id(
+ deny_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_deny_assignments_list_for_scope(self, resource_group):
+ response = self.client.deny_assignments.list_for_scope(
+ scope="str",
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_permissions_operations.py
new file mode 100644
index 000000000000..79c8b4023371
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_permissions_operations.py
@@ -0,0 +1,45 @@
+# 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.authorization import AuthorizationManagementClient
+
+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 TestAuthorizationManagementPermissionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_permissions_list_for_resource_group(self, resource_group):
+ response = self.client.permissions.list_for_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_permissions_list_for_resource(self, resource_group):
+ response = self.client.permissions.list_for_resource(
+ resource_group_name=resource_group.name,
+ resource_provider_namespace="str",
+ parent_resource_path="str",
+ resource_type="str",
+ resource_name="str",
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_permissions_operations_async.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_permissions_operations_async.py
new file mode 100644
index 000000000000..0895a875c3bf
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_permissions_operations_async.py
@@ -0,0 +1,46 @@
+# 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.authorization.aio import AuthorizationManagementClient
+
+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 TestAuthorizationManagementPermissionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_permissions_list_for_resource_group(self, resource_group):
+ response = self.client.permissions.list_for_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_permissions_list_for_resource(self, resource_group):
+ response = self.client.permissions.list_for_resource(
+ resource_group_name=resource_group.name,
+ resource_provider_namespace="str",
+ parent_resource_path="str",
+ resource_type="str",
+ resource_name="str",
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_provider_operations_metadata_operations.py
new file mode 100644
index 000000000000..b5304ccf6b3d
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_provider_operations_metadata_operations.py
@@ -0,0 +1,40 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.authorization import AuthorizationManagementClient
+
+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 TestAuthorizationManagementProviderOperationsMetadataOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_provider_operations_metadata_get(self, resource_group):
+ response = self.client.provider_operations_metadata.get(
+ resource_provider_namespace="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_provider_operations_metadata_list(self, resource_group):
+ response = self.client.provider_operations_metadata.list(
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_provider_operations_metadata_operations_async.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_provider_operations_metadata_operations_async.py
new file mode 100644
index 000000000000..ca1066e14d82
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_provider_operations_metadata_operations_async.py
@@ -0,0 +1,41 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.authorization.aio import AuthorizationManagementClient
+
+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 TestAuthorizationManagementProviderOperationsMetadataOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_provider_operations_metadata_get(self, resource_group):
+ response = await self.client.provider_operations_metadata.get(
+ resource_provider_namespace="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_provider_operations_metadata_list(self, resource_group):
+ response = self.client.provider_operations_metadata.list(
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_assignments_operations.py
new file mode 100644
index 000000000000..17e21c496f72
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_assignments_operations.py
@@ -0,0 +1,162 @@
+# 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.authorization import AuthorizationManagementClient
+
+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 TestAuthorizationManagementRoleAssignmentsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_list_for_subscription(self, resource_group):
+ response = self.client.role_assignments.list_for_subscription(
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_list_for_resource_group(self, resource_group):
+ response = self.client.role_assignments.list_for_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_list_for_resource(self, resource_group):
+ response = self.client.role_assignments.list_for_resource(
+ resource_group_name=resource_group.name,
+ resource_provider_namespace="str",
+ resource_type="str",
+ resource_name="str",
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_get(self, resource_group):
+ response = self.client.role_assignments.get(
+ scope="str",
+ role_assignment_name="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_create(self, resource_group):
+ response = self.client.role_assignments.create(
+ scope="str",
+ role_assignment_name="str",
+ parameters={
+ "principalId": "str",
+ "roleDefinitionId": "str",
+ "condition": "str",
+ "conditionVersion": "str",
+ "createdBy": "str",
+ "createdOn": "2020-02-20 00:00:00",
+ "delegatedManagedIdentityResourceId": "str",
+ "description": "str",
+ "principalType": "User",
+ "scope": "str",
+ "updatedBy": "str",
+ "updatedOn": "2020-02-20 00:00:00",
+ },
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_delete(self, resource_group):
+ response = self.client.role_assignments.delete(
+ scope="str",
+ role_assignment_name="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_list_for_scope(self, resource_group):
+ response = self.client.role_assignments.list_for_scope(
+ scope="str",
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_get_by_id(self, resource_group):
+ response = self.client.role_assignments.get_by_id(
+ role_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_create_by_id(self, resource_group):
+ response = self.client.role_assignments.create_by_id(
+ role_assignment_id="str",
+ parameters={
+ "principalId": "str",
+ "roleDefinitionId": "str",
+ "condition": "str",
+ "conditionVersion": "str",
+ "createdBy": "str",
+ "createdOn": "2020-02-20 00:00:00",
+ "delegatedManagedIdentityResourceId": "str",
+ "description": "str",
+ "principalType": "User",
+ "scope": "str",
+ "updatedBy": "str",
+ "updatedOn": "2020-02-20 00:00:00",
+ },
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_assignments_delete_by_id(self, resource_group):
+ response = self.client.role_assignments.delete_by_id(
+ role_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_assignments_operations_async.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_assignments_operations_async.py
new file mode 100644
index 000000000000..4a2eb270d1e0
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_assignments_operations_async.py
@@ -0,0 +1,163 @@
+# 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.authorization.aio import AuthorizationManagementClient
+
+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 TestAuthorizationManagementRoleAssignmentsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_list_for_subscription(self, resource_group):
+ response = self.client.role_assignments.list_for_subscription(
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_list_for_resource_group(self, resource_group):
+ response = self.client.role_assignments.list_for_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_list_for_resource(self, resource_group):
+ response = self.client.role_assignments.list_for_resource(
+ resource_group_name=resource_group.name,
+ resource_provider_namespace="str",
+ resource_type="str",
+ resource_name="str",
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_get(self, resource_group):
+ response = await self.client.role_assignments.get(
+ scope="str",
+ role_assignment_name="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_create(self, resource_group):
+ response = await self.client.role_assignments.create(
+ scope="str",
+ role_assignment_name="str",
+ parameters={
+ "principalId": "str",
+ "roleDefinitionId": "str",
+ "condition": "str",
+ "conditionVersion": "str",
+ "createdBy": "str",
+ "createdOn": "2020-02-20 00:00:00",
+ "delegatedManagedIdentityResourceId": "str",
+ "description": "str",
+ "principalType": "User",
+ "scope": "str",
+ "updatedBy": "str",
+ "updatedOn": "2020-02-20 00:00:00",
+ },
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_delete(self, resource_group):
+ response = await self.client.role_assignments.delete(
+ scope="str",
+ role_assignment_name="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_list_for_scope(self, resource_group):
+ response = self.client.role_assignments.list_for_scope(
+ scope="str",
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_get_by_id(self, resource_group):
+ response = await self.client.role_assignments.get_by_id(
+ role_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_create_by_id(self, resource_group):
+ response = await self.client.role_assignments.create_by_id(
+ role_assignment_id="str",
+ parameters={
+ "principalId": "str",
+ "roleDefinitionId": "str",
+ "condition": "str",
+ "conditionVersion": "str",
+ "createdBy": "str",
+ "createdOn": "2020-02-20 00:00:00",
+ "delegatedManagedIdentityResourceId": "str",
+ "description": "str",
+ "principalType": "User",
+ "scope": "str",
+ "updatedBy": "str",
+ "updatedOn": "2020-02-20 00:00:00",
+ },
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_assignments_delete_by_id(self, resource_group):
+ response = await self.client.role_assignments.delete_by_id(
+ role_assignment_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_definitions_operations.py
new file mode 100644
index 000000000000..35252dd0b6f9
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_definitions_operations.py
@@ -0,0 +1,92 @@
+# 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.authorization import AuthorizationManagementClient
+
+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 TestAuthorizationManagementRoleDefinitionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_definitions_delete(self, resource_group):
+ response = self.client.role_definitions.delete(
+ scope="str",
+ role_definition_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_definitions_get(self, resource_group):
+ response = self.client.role_definitions.get(
+ scope="str",
+ role_definition_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_definitions_create_or_update(self, resource_group):
+ response = self.client.role_definitions.create_or_update(
+ scope="str",
+ role_definition_id="str",
+ role_definition={
+ "assignableScopes": ["str"],
+ "createdBy": "str",
+ "createdOn": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "permissions": [
+ {"actions": ["str"], "dataActions": ["str"], "notActions": ["str"], "notDataActions": ["str"]}
+ ],
+ "roleName": "str",
+ "type": "str",
+ "updatedBy": "str",
+ "updatedOn": "2020-02-20 00:00:00",
+ },
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_definitions_list(self, resource_group):
+ response = self.client.role_definitions.list(
+ scope="str",
+ api_version="2022-04-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_role_definitions_get_by_id(self, resource_group):
+ response = self.client.role_definitions.get_by_id(
+ role_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_definitions_operations_async.py b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_definitions_operations_async.py
new file mode 100644
index 000000000000..d5e210e325ab
--- /dev/null
+++ b/sdk/authorization/azure-mgmt-authorization/generated_tests/test_authorization_management_role_definitions_operations_async.py
@@ -0,0 +1,93 @@
+# 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.authorization.aio import AuthorizationManagementClient
+
+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 TestAuthorizationManagementRoleDefinitionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AuthorizationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_definitions_delete(self, resource_group):
+ response = await self.client.role_definitions.delete(
+ scope="str",
+ role_definition_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_definitions_get(self, resource_group):
+ response = await self.client.role_definitions.get(
+ scope="str",
+ role_definition_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_definitions_create_or_update(self, resource_group):
+ response = await self.client.role_definitions.create_or_update(
+ scope="str",
+ role_definition_id="str",
+ role_definition={
+ "assignableScopes": ["str"],
+ "createdBy": "str",
+ "createdOn": "2020-02-20 00:00:00",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "permissions": [
+ {"actions": ["str"], "dataActions": ["str"], "notActions": ["str"], "notDataActions": ["str"]}
+ ],
+ "roleName": "str",
+ "type": "str",
+ "updatedBy": "str",
+ "updatedOn": "2020-02-20 00:00:00",
+ },
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_definitions_list(self, resource_group):
+ response = self.client.role_definitions.list(
+ scope="str",
+ api_version="2022-04-01",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_role_definitions_get_by_id(self, resource_group):
+ response = await self.client.role_definitions.get_by_id(
+ role_id="str",
+ api_version="2022-04-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/authorization/azure-mgmt-authorization/setup.py b/sdk/authorization/azure-mgmt-authorization/setup.py
index 5f47308c560a..4531e46f684d 100644
--- a/sdk/authorization/azure-mgmt-authorization/setup.py
+++ b/sdk/authorization/azure-mgmt-authorization/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",
)