diff --git a/sdk/billing/azure-mgmt-billing/_meta.json b/sdk/billing/azure-mgmt-billing/_meta.json index 02467a8e878a..fe8158ac1077 100644 --- a/sdk/billing/azure-mgmt-billing/_meta.json +++ b/sdk/billing/azure-mgmt-billing/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4522e1d3fb6dcb81bc63e3414d11dd7eaf08264b", + "commit": "b2cb4632861b9c33a7eeb8c9cf9eb7a3efd6dc03", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.8", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/billing/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.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/billing/resource-manager/readme.md --generate-sample=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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/billing/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py index 74c1389d56da..09499d2e1c56 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py index 7e4c78732354..5641becb99ab 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_billing_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import BillingManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -111,9 +111,9 @@ def __init__( self._config = BillingManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -181,15 +181,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> BillingManagementClient + def __enter__(self) -> "BillingManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py index 98ff01383d05..4d8b40a205af 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_configuration.py @@ -44,10 +44,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-billing/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_serialization.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_serialization.py index 7c1dedb5133d..842ae727fbbc 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_serialization.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: 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__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} 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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + 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 "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + 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}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + 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) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + 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) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_vendor.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_vendor.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_vendor.py @@ -5,6 +5,8 @@ # 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 @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # 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/billing/azure-mgmt-billing/azure/mgmt/billing/_version.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_version.py index c096871cfd88..92721eef7dd5 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_version.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.1.0b1" +VERSION = "0.3.0" diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/__init__.py index 3266627d8e18..4dc1c988e7c8 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/_billing_management_client.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/_billing_management_client.py index 7f769c44c36c..cc2fe1a2c387 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/_billing_management_client.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/_billing_management_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import BillingManagementClientConfiguration from .operations import ( @@ -112,9 +112,9 @@ def __init__( self._config = BillingManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -189,5 +189,5 @@ async def __aenter__(self) -> "BillingManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/__init__.py index 0f9808051bfd..f2d294b6f93c 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/__init__.py @@ -29,7 +29,7 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_address_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_address_operations.py index df9c98bd2cda..5b69ed6b442d 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_address_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_address_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._address_operations import build_validate_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,6 +57,9 @@ async def validate( """Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param address: Required. :type address: ~azure.mgmt.billing.models.AddressDetails :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -80,6 +78,9 @@ async def validate( """Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param address: Required. :type address: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -98,7 +99,10 @@ async def validate( """Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. - :param address: Is either a model type or a IO type. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + + :param address: Is either a AddressDetails type or a IO type. Required. :type address: ~azure.mgmt.billing.models.AddressDetails or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -119,9 +123,9 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateAddressResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateAddressResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -141,10 +145,11 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -161,4 +166,4 @@ async def validate( return deserialized - validate.metadata = {"url": "/providers/Microsoft.Billing/validateAddress"} # type: ignore + validate.metadata = {"url": "/providers/Microsoft.Billing/validateAddress"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_agreements_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_agreements_operations.py index f8ddcd6b9a36..ce4df4db1ea3 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_agreements_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_agreements_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._agreements_operations import build_get_request, build_list_by_billing_account_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +58,9 @@ def list_by_billing_account( ) -> AsyncIterable["_models.Agreement"]: """Lists the agreements for a billing account. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param expand: May be used to expand the participants. Default value is None. @@ -75,8 +73,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.AgreementListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,12 +96,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,14 +109,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AgreementListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,7 +130,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements" + } @distributed_trace_async async def get( @@ -139,6 +140,9 @@ async def get( ) -> _models.Agreement: """Gets an agreement by ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param agreement_name: The ID that uniquely identifies an agreement. Required. @@ -161,8 +165,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Agreement] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Agreement] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -174,10 +178,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,4 +199,6 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_available_balances_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_available_balances_operations.py index 1aed6003f84a..219caec2d884 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_available_balances_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_available_balances_operations.py @@ -6,7 +6,6 @@ # 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 ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._available_balances_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +58,9 @@ async def get( pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -83,8 +81,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailableBalance] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.AvailableBalance] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -95,10 +93,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -115,4 +114,6 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_accounts_operations.py index af7320fc1e98..6f9ffc9dc71a 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_accounts_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_accounts_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +36,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,6 +63,9 @@ def __init__(self, *args, **kwargs) -> None: def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.BillingAccount"]: """Lists the billing accounts that a user has access to. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param expand: May be used to expand the soldTo, invoice sections and billing profiles. Default value is None. :type expand: str @@ -79,8 +77,8 @@ def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,12 +99,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -114,14 +112,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,7 +133,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts"} @distributed_trace_async async def get( @@ -142,6 +141,9 @@ async def get( ) -> _models.BillingAccount: """Gets a billing account by its ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param expand: May be used to expand the soldTo, invoice sections and billing profiles. Default @@ -163,8 +165,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingAccount] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -175,10 +177,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,7 +198,7 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} async def _update_initial( self, billing_account_name: str, parameters: Union[_models.BillingAccountUpdateRequest, IO], **kwargs: Any @@ -211,9 +214,9 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BillingAccount]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BillingAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -234,10 +237,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,7 +260,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} # type: ignore + _update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} @overload async def begin_update( @@ -334,7 +338,7 @@ async def begin_update( :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the update billing account - operation. Is either a model type or a IO type. Required. + operation. Is either a BillingAccountUpdateRequest type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.BillingAccountUpdateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -355,14 +359,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingAccount] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( billing_account_name=billing_account_name, parameters=parameters, api_version=api_version, @@ -381,10 +385,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -396,18 +400,21 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} # type: ignore + begin_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} @distributed_trace - def list_invoice_sections_by_create_subscription_permission( + def list_invoice_sections_by_create_subscription_permission( # pylint: disable=name-too-long self, billing_account_name: str, **kwargs: Any ) -> AsyncIterable["_models.InvoiceSectionWithCreateSubPermission"]: """Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -420,8 +427,8 @@ def list_invoice_sections_by_create_subscription_permission( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSectionListWithCreateSubPermissionResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceSectionListWithCreateSubPermissionResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -442,12 +449,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -455,14 +462,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceSectionListWithCreateSubPermissionResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,4 +483,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_invoice_sections_by_create_subscription_permission.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission"} # type: ignore + list_invoice_sections_by_create_subscription_permission.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_periods_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_periods_operations.py index 98ef643eb0bd..cccc84c0e42b 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_periods_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_periods_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._billing_periods_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,6 +60,9 @@ def list( only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + .. seealso:: + - https://go.microsoft.com/fwlink/?linkid=844490 + :param filter: May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Default value is None. @@ -85,10 +83,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPeriodsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.BillingPeriodsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -112,12 +108,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,14 +121,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingPeriodsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,7 +142,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods"} @distributed_trace_async async def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingPeriod: @@ -171,10 +168,8 @@ async def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingP _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPeriod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.BillingPeriod] = kwargs.pop("cls", None) request = build_get_request( billing_period_name=billing_period_name, @@ -185,10 +180,11 @@ async def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingP params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,4 +201,6 @@ async def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingP return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_permissions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_permissions_operations.py index 7cfe5db29af3..bd75a0669eee 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_permissions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_permissions_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,10 +33,6 @@ build_list_by_invoice_sections_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +62,9 @@ def list_by_customer( ) -> AsyncIterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has for a customer. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -81,8 +79,8 @@ def list_by_customer( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,12 +102,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,14 +115,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -137,7 +136,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions"} # type: ignore + list_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions" + } @distributed_trace def list_by_billing_account( @@ -145,6 +146,9 @@ def list_by_billing_account( ) -> AsyncIterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has on a billing account. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -157,8 +161,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -179,12 +183,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -192,14 +196,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -212,7 +217,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions" + } @distributed_trace def list_by_invoice_sections( @@ -220,6 +227,9 @@ def list_by_invoice_sections( ) -> AsyncIterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has on an invoice section. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -236,8 +246,8 @@ def list_by_invoice_sections( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -260,12 +270,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -273,14 +283,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,7 +304,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_invoice_sections.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions"} # type: ignore + list_by_invoice_sections.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions" + } @distributed_trace def list_by_billing_profile( @@ -301,6 +314,9 @@ def list_by_billing_profile( ) -> AsyncIterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has on a billing profile. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -315,8 +331,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -338,12 +354,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -351,14 +367,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -371,4 +388,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_profiles_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_profiles_operations.py index 21450a31dacb..f532ada5b253 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_profiles_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_profiles_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,10 +35,6 @@ build_list_by_billing_account_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +65,9 @@ def list_by_billing_account( """Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param expand: May be used to expand the invoice sections. Default value is None. @@ -82,8 +80,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProfileListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingProfileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,12 +103,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,14 +116,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,7 +137,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles" + } @distributed_trace_async async def get( @@ -147,6 +148,9 @@ async def get( """Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -169,8 +173,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProfile] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingProfile] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -182,10 +186,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -202,7 +207,9 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + } async def _create_or_update_initial( self, @@ -222,9 +229,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BillingProfile]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BillingProfile]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -246,10 +253,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -273,7 +281,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + } @overload async def begin_create_or_update( @@ -362,8 +372,8 @@ async def begin_create_or_update( :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. :type billing_profile_name: str - :param parameters: The new or updated billing profile. Is either a model type or a IO type. - Required. + :param parameters: The new or updated billing profile. Is either a BillingProfile type or a IO + type. Required. :type parameters: ~azure.mgmt.billing.models.BillingProfile or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -384,14 +394,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProfile] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, parameters=parameters, @@ -411,7 +421,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -423,6 +433,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_property_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_property_operations.py index 098fcc9773ab..c4ad72553d7b 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_property_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_property_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._billing_property_operations import build_get_request, build_update_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,6 +55,9 @@ async def get(self, **kwargs: Any) -> _models.BillingProperty: """Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :keyword callable cls: A custom type or function that will be passed the direct response :return: BillingProperty or the result of cls(response) :rtype: ~azure.mgmt.billing.models.BillingProperty @@ -76,8 +74,8 @@ async def get(self, **kwargs: Any) -> _models.BillingProperty: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProperty] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingProperty] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,10 +85,11 @@ async def get(self, **kwargs: Any) -> _models.BillingProperty: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -107,7 +106,7 @@ async def get(self, **kwargs: Any) -> _models.BillingProperty: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} @overload async def update( @@ -156,7 +155,7 @@ async def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: Agreement. :param parameters: Request parameters that are provided to the update billing property - operation. Is either a model type or a IO type. Required. + operation. Is either a BillingProperty type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.BillingProperty or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -177,9 +176,9 @@ async def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProperty] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -200,10 +199,11 @@ async def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,4 +220,4 @@ async def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_assignments_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_assignments_operations.py index 878b149c2056..f48348f60903 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_assignments_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_assignments_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,10 +39,6 @@ build_list_by_invoice_section_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,6 +70,9 @@ async def get_by_billing_account( billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_role_assignment_name: The ID that uniquely identifies a role assignment. @@ -96,8 +94,8 @@ async def get_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_get_by_billing_account_request( billing_account_name=billing_account_name, @@ -108,10 +106,11 @@ async def get_by_billing_account( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -128,7 +127,9 @@ async def get_by_billing_account( return deserialized - get_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + get_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace_async async def delete_by_billing_account( @@ -159,8 +160,8 @@ async def delete_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_delete_by_billing_account_request( billing_account_name=billing_account_name, @@ -171,10 +172,11 @@ async def delete_by_billing_account( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +193,9 @@ async def delete_by_billing_account( return deserialized - delete_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + delete_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace_async async def get_by_invoice_section( @@ -205,6 +209,9 @@ async def get_by_invoice_section( """Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -230,8 +237,8 @@ async def get_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_get_by_invoice_section_request( billing_account_name=billing_account_name, @@ -244,10 +251,11 @@ async def get_by_invoice_section( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,7 +272,9 @@ async def get_by_invoice_section( return deserialized - get_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + get_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace_async async def delete_by_invoice_section( @@ -303,8 +313,8 @@ async def delete_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_delete_by_invoice_section_request( billing_account_name=billing_account_name, @@ -317,10 +327,11 @@ async def delete_by_invoice_section( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,7 +348,9 @@ async def delete_by_invoice_section( return deserialized - delete_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + delete_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace_async async def get_by_billing_profile( @@ -347,6 +360,9 @@ async def get_by_billing_profile( billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -370,8 +386,8 @@ async def get_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_get_by_billing_profile_request( billing_account_name=billing_account_name, @@ -383,10 +399,11 @@ async def get_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,7 +420,9 @@ async def get_by_billing_profile( return deserialized - get_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + get_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace_async async def delete_by_billing_profile( @@ -436,8 +455,8 @@ async def delete_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_delete_by_billing_profile_request( billing_account_name=billing_account_name, @@ -449,10 +468,11 @@ async def delete_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -469,7 +489,9 @@ async def delete_by_billing_profile( return deserialized - delete_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + delete_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace def list_by_billing_account( @@ -479,6 +501,9 @@ def list_by_billing_account( billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -491,8 +516,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignmentListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -513,12 +538,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -526,14 +551,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,7 +572,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments" + } @distributed_trace def list_by_invoice_section( @@ -555,6 +583,9 @@ def list_by_invoice_section( """Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -571,8 +602,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignmentListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -595,12 +626,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -608,14 +639,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -628,7 +660,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments" + } @distributed_trace def list_by_billing_profile( @@ -637,6 +671,9 @@ def list_by_billing_profile( """Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -651,8 +688,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignmentListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -674,12 +711,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -687,14 +724,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -707,4 +745,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_definitions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_definitions_operations.py index 794744bba3d7..edd494fb7422 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_definitions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_role_definitions_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,10 +36,6 @@ build_list_by_invoice_section_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,6 +66,9 @@ async def get_by_billing_account( """Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_role_definition_name: The ID that uniquely identifies a role definition. @@ -92,8 +90,8 @@ async def get_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinition] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinition] = kwargs.pop("cls", None) request = build_get_by_billing_account_request( billing_account_name=billing_account_name, @@ -104,10 +102,11 @@ async def get_by_billing_account( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -124,7 +123,9 @@ async def get_by_billing_account( return deserialized - get_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}"} # type: ignore + get_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}" + } @distributed_trace_async async def get_by_invoice_section( @@ -138,6 +139,9 @@ async def get_by_invoice_section( """Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -163,8 +167,8 @@ async def get_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinition] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinition] = kwargs.pop("cls", None) request = build_get_by_invoice_section_request( billing_account_name=billing_account_name, @@ -177,10 +181,11 @@ async def get_by_invoice_section( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -197,7 +202,9 @@ async def get_by_invoice_section( return deserialized - get_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}"} # type: ignore + get_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}" + } @distributed_trace_async async def get_by_billing_profile( @@ -206,6 +213,9 @@ async def get_by_billing_profile( """Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -229,8 +239,8 @@ async def get_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinition] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinition] = kwargs.pop("cls", None) request = build_get_by_billing_profile_request( billing_account_name=billing_account_name, @@ -242,10 +252,11 @@ async def get_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -262,7 +273,9 @@ async def get_by_billing_profile( return deserialized - get_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}"} # type: ignore + get_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}" + } @distributed_trace def list_by_billing_account( @@ -271,6 +284,9 @@ def list_by_billing_account( """Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -283,8 +299,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinitionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -305,12 +321,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -318,14 +334,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -338,7 +355,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions" + } @distributed_trace def list_by_invoice_section( @@ -347,6 +366,9 @@ def list_by_invoice_section( """Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -363,8 +385,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinitionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -387,12 +409,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -400,14 +422,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,7 +443,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions" + } @distributed_trace def list_by_billing_profile( @@ -429,6 +454,9 @@ def list_by_billing_profile( """Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -443,8 +471,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinitionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -466,12 +494,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -479,14 +507,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -499,4 +528,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_subscriptions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_subscriptions_operations.py index a4d1aad19523..2fbdcf3f916b 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_subscriptions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_billing_subscriptions_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -41,10 +40,6 @@ build_validate_move_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,6 +70,9 @@ def list_by_customer( """Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -87,8 +85,8 @@ def list_by_customer( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,12 +108,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -123,14 +121,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,7 +142,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions"} # type: ignore + list_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions" + } @distributed_trace def list_by_billing_account( @@ -152,6 +153,9 @@ def list_by_billing_account( """Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -162,8 +166,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -184,12 +188,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -197,14 +201,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,7 +222,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions" + } @distributed_trace def list_by_billing_profile( @@ -227,6 +234,9 @@ def list_by_billing_profile( billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -239,8 +249,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -262,12 +272,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -275,14 +285,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,7 +306,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions" + } @distributed_trace def list_by_invoice_section( @@ -304,6 +317,9 @@ def list_by_invoice_section( """Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -318,8 +334,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -342,12 +358,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -355,14 +371,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,13 +392,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions" + } @distributed_trace_async async def get(self, billing_account_name: str, **kwargs: Any) -> _models.BillingSubscription: """Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -400,8 +422,8 @@ async def get(self, billing_account_name: str, **kwargs: Any) -> _models.Billing _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscription] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscription] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -412,10 +434,11 @@ async def get(self, billing_account_name: str, **kwargs: Any) -> _models.Billing params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -432,7 +455,9 @@ async def get(self, billing_account_name: str, **kwargs: Any) -> _models.Billing return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}" + } @overload async def update( @@ -494,7 +519,7 @@ async def update( :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the update billing subscription - operation. Is either a model type or a IO type. Required. + operation. Is either a BillingSubscription type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.BillingSubscription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -515,9 +540,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscription] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingSubscription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -539,10 +564,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -559,7 +585,9 @@ async def update( return deserialized - update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}"} # type: ignore + update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}" + } async def _move_initial( self, @@ -578,9 +606,9 @@ async def _move_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BillingSubscription]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BillingSubscription]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -602,10 +630,11 @@ async def _move_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -629,7 +658,9 @@ async def _move_initial( return deserialized - _move_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move"} # type: ignore + _move_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move" + } @overload async def begin_move( @@ -644,6 +675,9 @@ async def begin_move( the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the move subscription operation. @@ -674,6 +708,9 @@ async def begin_move( the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the move subscription operation. @@ -707,10 +744,13 @@ async def begin_move( the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the move subscription operation. Is - either a model type or a IO type. Required. + either a TransferBillingSubscriptionRequestProperties type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.TransferBillingSubscriptionRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -731,14 +771,14 @@ async def begin_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscription] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingSubscription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._move_initial( # type: ignore + raw_result = await self._move_initial( billing_account_name=billing_account_name, parameters=parameters, api_version=api_version, @@ -757,7 +797,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -769,9 +809,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move"} # type: ignore + begin_move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move" + } @overload async def validate_move( @@ -785,6 +827,9 @@ async def validate_move( """Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the validate move eligibility @@ -806,6 +851,9 @@ async def validate_move( """Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the validate move eligibility @@ -830,10 +878,14 @@ async def validate_move( """Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the validate move eligibility - operation. Is either a model type or a IO type. Required. + operation. Is either a TransferBillingSubscriptionRequestProperties type or a IO type. + Required. :type parameters: ~azure.mgmt.billing.models.TransferBillingSubscriptionRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -854,9 +906,9 @@ async def validate_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateSubscriptionTransferEligibilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateSubscriptionTransferEligibilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -878,10 +930,11 @@ async def validate_move( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,4 +951,6 @@ async def validate_move( return deserialized - validate_move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility"} # type: ignore + validate_move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_customers_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_customers_operations.py index a8ee26c5d66c..1923fcdd33c0 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_customers_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_customers_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,10 +33,6 @@ build_list_by_billing_profile_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,6 +68,9 @@ def list_by_billing_profile( """Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -90,8 +88,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.CustomerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,12 +113,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,14 +126,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,7 +147,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers" + } @distributed_trace def list_by_billing_account( @@ -157,6 +158,9 @@ def list_by_billing_account( """Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param search: Used for searching customers by their name. Any customer with name containing @@ -172,8 +176,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.CustomerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,12 +200,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,14 +213,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -229,7 +234,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers" + } @distributed_trace_async async def get( @@ -238,6 +245,9 @@ async def get( """Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -260,8 +270,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Customer] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Customer] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -273,10 +283,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,4 +304,4 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_enrollment_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_enrollment_accounts_operations.py index 86195c86e34a..ce747fb85b6a 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_enrollment_accounts_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_enrollment_accounts_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._enrollment_accounts_operations import build_get_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +66,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EnrollmentAccountSummary _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrollmentAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.EnrollmentAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,12 +87,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -107,14 +100,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EnrollmentAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -127,7 +121,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts"} @distributed_trace_async async def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummary: @@ -151,10 +145,8 @@ async def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrollmentAccountSummary] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.EnrollmentAccountSummary] = kwargs.pop("cls", None) request = build_get_request( name=name, @@ -164,10 +156,11 @@ async def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummar params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,4 +177,4 @@ async def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummar return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts/{name}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts/{name}"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_instructions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_instructions_operations.py index fdac3cad2072..4834a1a4077d 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_instructions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_instructions_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,10 +33,6 @@ build_put_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +62,9 @@ def list_by_billing_profile( ) -> AsyncIterable["_models.Instruction"]: """Lists the instructions by billing profile id. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -79,8 +77,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InstructionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InstructionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,12 +100,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -115,14 +113,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InstructionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -135,7 +134,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions" + } @distributed_trace_async async def get( @@ -144,6 +145,9 @@ async def get( """Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -166,8 +170,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Instruction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Instruction] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -179,10 +183,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -199,7 +204,9 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}" + } @overload async def put( @@ -281,7 +288,7 @@ async def put( :type billing_profile_name: str :param instruction_name: Instruction Name. Required. :type instruction_name: str - :param parameters: The new instruction. Is either a model type or a IO type. Required. + :param parameters: The new instruction. Is either a Instruction type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.Instruction or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -302,9 +309,9 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Instruction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Instruction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,10 +334,11 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,4 +355,6 @@ async def put( return deserialized - put.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}"} # type: ignore + put.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoice_sections_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoice_sections_operations.py index fcfdeb076608..ce5ac30f62e0 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoice_sections_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoice_sections_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,10 +35,6 @@ build_list_by_billing_profile_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,6 +65,9 @@ def list_by_billing_profile( """Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -82,8 +80,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSectionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceSectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,12 +103,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,14 +116,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceSectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,7 +137,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections" + } @distributed_trace_async async def get( @@ -147,6 +148,9 @@ async def get( """Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -169,8 +173,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceSection] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -182,10 +186,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -202,7 +207,9 @@ async def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" + } async def _create_or_update_initial( self, @@ -223,9 +230,9 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.InvoiceSection]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.InvoiceSection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -248,10 +255,11 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -275,7 +283,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" + } @overload async def begin_create_or_update( @@ -373,8 +383,8 @@ async def begin_create_or_update( :type billing_profile_name: str :param invoice_section_name: The ID that uniquely identifies an invoice section. Required. :type invoice_section_name: str - :param parameters: The new or updated invoice section. Is either a model type or a IO type. - Required. + :param parameters: The new or updated invoice section. Is either a InvoiceSection type or a IO + type. Required. :type parameters: ~azure.mgmt.billing.models.InvoiceSection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -395,14 +405,14 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InvoiceSection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, invoice_section_name=invoice_section_name, @@ -423,7 +433,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -435,6 +445,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoices_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoices_operations.py index 5d47aba1dbc2..1d7fa125c1ae 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoices_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_invoices_operations.py @@ -6,7 +6,6 @@ # 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, IO, List, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,10 +42,6 @@ build_list_by_billing_subscription_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,6 +73,9 @@ def list_by_billing_account( supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param period_start_date: The start date to fetch the invoices. The date should be specified in @@ -94,8 +92,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -118,12 +116,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,14 +129,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,7 +150,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices" + } @distributed_trace def list_by_billing_profile( @@ -166,6 +167,9 @@ def list_by_billing_profile( supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -184,8 +188,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -209,12 +213,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -222,14 +226,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,13 +247,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices" + } @distributed_trace_async async def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) -> _models.Invoice: """Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param invoice_name: The ID that uniquely identifies an invoice. Required. @@ -269,8 +279,8 @@ async def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Invoice] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Invoice] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -281,10 +291,11 @@ async def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,13 +312,16 @@ async def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"} @distributed_trace_async async def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: """Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param invoice_name: The ID that uniquely identifies an invoice. Required. :type invoice_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -326,8 +340,8 @@ async def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Invoice] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Invoice] = kwargs.pop("cls", None) request = build_get_by_id_request( invoice_name=invoice_name, @@ -337,10 +351,11 @@ async def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -357,7 +372,7 @@ async def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}"} # type: ignore + get_by_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}"} async def _download_invoice_initial( self, billing_account_name: str, invoice_name: str, download_token: str, **kwargs: Any @@ -373,8 +388,8 @@ async def _download_invoice_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) request = build_download_invoice_request( billing_account_name=billing_account_name, @@ -386,10 +401,11 @@ async def _download_invoice_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +429,9 @@ async def _download_invoice_initial( return deserialized - _download_invoice_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download"} # type: ignore + _download_invoice_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download" + } @distributed_trace_async async def begin_download_invoice( @@ -422,6 +440,9 @@ async def begin_download_invoice( """Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param invoice_name: The ID that uniquely identifies an invoice. Required. @@ -444,13 +465,13 @@ async def begin_download_invoice( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._download_invoice_initial( # type: ignore + raw_result = await self._download_invoice_initial( billing_account_name=billing_account_name, invoice_name=invoice_name, download_token=download_token, @@ -469,9 +490,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -483,11 +504,13 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_invoice.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download"} # type: ignore + begin_download_invoice.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download" + } - async def _download_multiple_billing_profile_invoices_initial( + async def _download_multiple_billing_profile_invoices_initial( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: Union[List[str], IO], **kwargs: Any ) -> Optional[_models.DownloadUrl]: error_map = { @@ -501,9 +524,9 @@ async def _download_multiple_billing_profile_invoices_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -524,10 +547,11 @@ async def _download_multiple_billing_profile_invoices_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -551,10 +575,12 @@ async def _download_multiple_billing_profile_invoices_initial( return deserialized - _download_multiple_billing_profile_invoices_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments"} # type: ignore + _download_multiple_billing_profile_invoices_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments" + } @overload - async def begin_download_multiple_billing_profile_invoices( + async def begin_download_multiple_billing_profile_invoices( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: List[str], @@ -566,6 +592,9 @@ async def begin_download_multiple_billing_profile_invoices( a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param download_urls: An array of download urls for individual documents. Required. @@ -588,13 +617,16 @@ async def begin_download_multiple_billing_profile_invoices( """ @overload - async def begin_download_multiple_billing_profile_invoices( + async def begin_download_multiple_billing_profile_invoices( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: IO, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param download_urls: An array of download urls for individual documents. Required. @@ -617,17 +649,20 @@ async def begin_download_multiple_billing_profile_invoices( """ @distributed_trace_async - async def begin_download_multiple_billing_profile_invoices( + async def begin_download_multiple_billing_profile_invoices( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: Union[List[str], IO], **kwargs: Any ) -> AsyncLROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str - :param download_urls: An array of download urls for individual documents. Is either a list type - or a IO type. Required. + :param download_urls: An array of download urls for individual documents. Is either a [str] + type or a IO type. Required. :type download_urls: list[str] or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -648,14 +683,14 @@ async def begin_download_multiple_billing_profile_invoices( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._download_multiple_billing_profile_invoices_initial( # type: ignore + raw_result = await self._download_multiple_billing_profile_invoices_initial( billing_account_name=billing_account_name, download_urls=download_urls, api_version=api_version, @@ -674,9 +709,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -688,9 +723,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_multiple_billing_profile_invoices.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments"} # type: ignore + begin_download_multiple_billing_profile_invoices.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments" + } @distributed_trace def list_by_billing_subscription( @@ -698,6 +735,9 @@ def list_by_billing_subscription( ) -> AsyncIterable["_models.Invoice"]: """Lists the invoices for a subscription. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param period_start_date: Invoice period start date. Required. :type period_start_date: str :param period_end_date: Invoice period end date. Required. @@ -710,8 +750,8 @@ def list_by_billing_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -734,12 +774,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -747,14 +787,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -767,12 +808,17 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_subscription.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices"} # type: ignore + list_by_billing_subscription.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices" + } @distributed_trace_async async def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: """Gets an invoice by subscription ID and invoice ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param invoice_name: The ID that uniquely identifies an invoice. Required. :type invoice_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -791,8 +837,8 @@ async def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Invoice] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Invoice] = kwargs.pop("cls", None) request = build_get_by_subscription_and_invoice_id_request( invoice_name=invoice_name, @@ -803,10 +849,11 @@ async def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -823,9 +870,11 @@ async def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: return deserialized - get_by_subscription_and_invoice_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}"} # type: ignore + get_by_subscription_and_invoice_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}" + } - async def _download_billing_subscription_invoice_initial( + async def _download_billing_subscription_invoice_initial( # pylint: disable=name-too-long self, invoice_name: str, download_token: str, **kwargs: Any ) -> Optional[_models.DownloadUrl]: error_map = { @@ -839,8 +888,8 @@ async def _download_billing_subscription_invoice_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) request = build_download_billing_subscription_invoice_request( invoice_name=invoice_name, @@ -852,10 +901,11 @@ async def _download_billing_subscription_invoice_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -879,14 +929,19 @@ async def _download_billing_subscription_invoice_initial( return deserialized - _download_billing_subscription_invoice_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download"} # type: ignore + _download_billing_subscription_invoice_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download" + } @distributed_trace_async - async def begin_download_billing_subscription_invoice( + async def begin_download_billing_subscription_invoice( # pylint: disable=name-too-long self, invoice_name: str, download_token: str, **kwargs: Any ) -> AsyncLROPoller[_models.DownloadUrl]: """Gets a URL to download an invoice. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param invoice_name: The ID that uniquely identifies an invoice. Required. :type invoice_name: str :param download_token: Download token with document source and document ID. Required. @@ -907,13 +962,13 @@ async def begin_download_billing_subscription_invoice( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._download_billing_subscription_invoice_initial( # type: ignore + raw_result = await self._download_billing_subscription_invoice_initial( invoice_name=invoice_name, download_token=download_token, api_version=api_version, @@ -931,9 +986,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -945,11 +1000,13 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_billing_subscription_invoice.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download"} # type: ignore + begin_download_billing_subscription_invoice.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download" + } - async def _download_multiple_billing_subscription_invoices_initial( + async def _download_multiple_billing_subscription_invoices_initial( # pylint: disable=name-too-long self, download_urls: Union[List[str], IO], **kwargs: Any ) -> Optional[_models.DownloadUrl]: error_map = { @@ -963,9 +1020,9 @@ async def _download_multiple_billing_subscription_invoices_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -986,10 +1043,11 @@ async def _download_multiple_billing_subscription_invoices_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,15 +1071,20 @@ async def _download_multiple_billing_subscription_invoices_initial( return deserialized - _download_multiple_billing_subscription_invoices_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments"} # type: ignore + _download_multiple_billing_subscription_invoices_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments" + } @overload - async def begin_download_multiple_billing_subscription_invoices( + async def begin_download_multiple_billing_subscription_invoices( # pylint: disable=name-too-long self, download_urls: List[str], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param download_urls: An array of download urls for individual documents. Required. :type download_urls: list[str] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1042,12 +1105,15 @@ async def begin_download_multiple_billing_subscription_invoices( """ @overload - async def begin_download_multiple_billing_subscription_invoices( + async def begin_download_multiple_billing_subscription_invoices( # pylint: disable=name-too-long self, download_urls: IO, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param download_urls: An array of download urls for individual documents. Required. :type download_urls: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1068,14 +1134,17 @@ async def begin_download_multiple_billing_subscription_invoices( """ @distributed_trace_async - async def begin_download_multiple_billing_subscription_invoices( + async def begin_download_multiple_billing_subscription_invoices( # pylint: disable=name-too-long self, download_urls: Union[List[str], IO], **kwargs: Any ) -> AsyncLROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. - :param download_urls: An array of download urls for individual documents. Is either a list type - or a IO type. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + + :param download_urls: An array of download urls for individual documents. Is either a [str] + type or a IO type. Required. :type download_urls: list[str] or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1096,14 +1165,14 @@ async def begin_download_multiple_billing_subscription_invoices( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._download_multiple_billing_subscription_invoices_initial( # type: ignore + raw_result = await self._download_multiple_billing_subscription_invoices_initial( download_urls=download_urls, api_version=api_version, content_type=content_type, @@ -1121,9 +1190,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1135,6 +1204,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_multiple_billing_subscription_invoices.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments"} # type: ignore + begin_download_multiple_billing_subscription_invoices.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_operations.py index 8c22ed098152..d4ca4b46e67d 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,6 +55,9 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists the available billing REST API operations. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :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.billing.models.Operation] @@ -68,8 +66,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -89,12 +87,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -102,14 +100,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -122,4 +121,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Billing/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Billing/operations"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_policies_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_policies_operations.py index d4667d03407b..cbb36f1631c4 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_policies_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_policies_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,10 +32,6 @@ build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +62,9 @@ async def get_by_billing_profile( """Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -87,8 +85,8 @@ async def get_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) request = build_get_by_billing_profile_request( billing_account_name=billing_account_name, @@ -99,10 +97,11 @@ async def get_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -119,7 +118,9 @@ async def get_by_billing_profile( return deserialized - get_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default"} # type: ignore + get_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default" + } @overload async def update( @@ -191,7 +192,7 @@ async def update( :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. :type billing_profile_name: str :param parameters: Request parameters that are provided to the update policies operation. Is - either a model type or a IO type. Required. + either a Policy type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.Policy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -212,9 +213,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -236,10 +237,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,7 +258,9 @@ async def update( return deserialized - update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default"} # type: ignore + update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default" + } @distributed_trace_async async def get_by_customer( @@ -265,6 +269,9 @@ async def get_by_customer( """Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -285,8 +292,8 @@ async def get_by_customer( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerPolicy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.CustomerPolicy] = kwargs.pop("cls", None) request = build_get_by_customer_request( billing_account_name=billing_account_name, @@ -297,10 +304,11 @@ async def get_by_customer( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,7 +325,9 @@ async def get_by_customer( return deserialized - get_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default"} # type: ignore + get_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default" + } @overload async def update_customer( @@ -393,7 +403,7 @@ async def update_customer( :param customer_name: The ID that uniquely identifies a customer. Required. :type customer_name: str :param parameters: Request parameters that are provided to the update policies operation. Is - either a model type or a IO type. Required. + either a CustomerPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.CustomerPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -414,9 +424,9 @@ async def update_customer( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerPolicy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomerPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -438,10 +448,11 @@ async def update_customer( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,4 +469,6 @@ async def update_customer( return deserialized - update_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default"} # type: ignore + update_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_products_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_products_operations.py index 4aaa8924fb10..4a78623419a1 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_products_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_products_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,10 +38,6 @@ build_validate_move_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,6 +69,9 @@ def list_by_customer( operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -86,8 +84,8 @@ def list_by_customer( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,12 +107,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,14 +120,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -142,7 +141,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products"} # type: ignore + list_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products" + } @distributed_trace def list_by_billing_account( @@ -152,6 +153,9 @@ def list_by_billing_account( The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param filter: May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', @@ -166,8 +170,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -189,12 +193,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -202,14 +206,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,7 +227,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products" + } @distributed_trace def list_by_billing_profile( @@ -232,6 +239,9 @@ def list_by_billing_profile( The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -248,8 +258,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -272,12 +282,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -285,14 +295,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,7 +316,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products" + } @distributed_trace def list_by_invoice_section( @@ -320,6 +333,9 @@ def list_by_invoice_section( The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -338,8 +354,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -363,12 +379,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -376,14 +392,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,13 +413,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products" + } @distributed_trace_async async def get(self, billing_account_name: str, product_name: str, **kwargs: Any) -> _models.Product: """Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -423,8 +445,8 @@ async def get(self, billing_account_name: str, product_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Product] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -435,10 +457,11 @@ async def get(self, billing_account_name: str, product_name: str, **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -455,7 +478,7 @@ async def get(self, billing_account_name: str, product_name: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}"} @overload async def update( @@ -527,7 +550,7 @@ async def update( :param product_name: The ID that uniquely identifies a product. Required. :type product_name: str :param parameters: Request parameters that are provided to the update product operation. Is - either a model type or a IO type. Required. + either a Product type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.Product or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -548,9 +571,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Product] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,10 +595,11 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,7 +616,9 @@ async def update( return deserialized - update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}"} # type: ignore + update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}" + } @overload async def move( @@ -609,6 +635,9 @@ async def move( products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -640,6 +669,9 @@ async def move( products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -669,12 +701,15 @@ async def move( products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. :type product_name: str :param parameters: Request parameters that are provided to the move product operation. Is - either a model type or a IO type. Required. + either a TransferProductRequestProperties type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.TransferProductRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -695,9 +730,9 @@ async def move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Product]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Product]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -719,10 +754,11 @@ async def move( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -746,7 +782,9 @@ async def move( return deserialized - move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move"} # type: ignore + move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move" + } @overload async def validate_move( @@ -762,6 +800,9 @@ async def validate_move( supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -792,6 +833,9 @@ async def validate_move( supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -820,12 +864,15 @@ async def validate_move( supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. :type product_name: str :param parameters: Request parameters that are provided to the validate move eligibility - operation. Is either a model type or a IO type. Required. + operation. Is either a TransferProductRequestProperties type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.TransferProductRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -846,9 +893,9 @@ async def validate_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateProductTransferEligibilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateProductTransferEligibilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -870,10 +917,11 @@ async def validate_move( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -890,4 +938,6 @@ async def validate_move( return deserialized - validate_move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility"} # type: ignore + validate_move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_reservations_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_reservations_operations.py index f51238dafb12..9797f8549062 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_reservations_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_reservations_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,10 +31,6 @@ build_list_by_billing_profile_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,8 +88,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReservationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ReservationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -119,12 +114,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,14 +127,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReservationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,7 +148,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservations"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservations" + } @distributed_trace def list_by_billing_profile( @@ -191,8 +189,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReservationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ReservationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -218,12 +216,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -231,14 +229,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ReservationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,4 +250,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/reservations"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/reservations" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_transactions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_transactions_operations.py index e3172450062f..c5193cdb56a8 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_transactions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/aio/operations/_transactions_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._transactions_operations import build_list_by_invoice_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,6 +58,9 @@ def list_by_invoice( """Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param invoice_name: The ID that uniquely identifies an invoice. Required. @@ -75,8 +73,8 @@ def list_by_invoice( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TransactionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.TransactionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,12 +96,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -111,14 +109,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TransactionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,4 +130,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_invoice.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions"} # type: ignore + list_by_invoice.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py index eb8dd8aac687..6a38d101db01 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/__init__.py @@ -121,7 +121,7 @@ from ._billing_management_client_enums import ViewCharges from ._billing_management_client_enums import ViewChargesPolicy from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py index 0e18b58b1f8f..3d62a13359e2 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -91,8 +91,8 @@ def __init__( postal_code: Optional[str] = None, email: Optional[str] = None, phone_number: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword first_name: First name. :paramtype first_name: str @@ -165,7 +165,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -232,7 +232,7 @@ class Agreement(Resource): # pylint: disable=too-many-instance-attributes "status": {"key": "properties.status", "type": "str"}, } - def __init__(self, *, participants: Optional[List["_models.Participants"]] = None, **kwargs): + def __init__(self, *, participants: Optional[List["_models.Participants"]] = None, **kwargs: Any) -> None: """ :keyword participants: The list of participants that participates in acceptance of an agreement. @@ -270,7 +270,7 @@ class AgreementListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -297,7 +297,7 @@ class Amount(_serialization.Model): "value": {"key": "value", "type": "float"}, } - def __init__(self, *, value: Optional[float] = None, **kwargs): + def __init__(self, *, value: Optional[float] = None, **kwargs: Any) -> None: """ :keyword value: Amount value. :paramtype value: float @@ -336,7 +336,7 @@ class AvailableBalance(Resource): "amount": {"key": "properties.amount", "type": "Amount"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.amount = None @@ -362,7 +362,7 @@ class AzurePlan(_serialization.Model): "sku_description": {"key": "skuDescription", "type": "str"}, } - def __init__(self, *, sku_id: Optional[str] = None, **kwargs): + def __init__(self, *, sku_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword sku_id: The sku id. :paramtype sku_id: str @@ -450,8 +450,8 @@ def __init__( departments: Optional[List["_models.Department"]] = None, enrollment_accounts: Optional[List["_models.EnrollmentAccount"]] = None, notification_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The billing account name. :paramtype display_name: str @@ -503,7 +503,7 @@ class BillingAccountListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -576,8 +576,8 @@ def __init__( departments: Optional[List["_models.Department"]] = None, enrollment_accounts: Optional[List["_models.EnrollmentAccount"]] = None, notification_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The billing account name. :paramtype display_name: str @@ -645,7 +645,7 @@ class BillingPeriod(Resource): "invoice_ids": {"key": "properties.invoiceIds", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.billing_period_start_date = None @@ -654,7 +654,8 @@ def __init__(self, **kwargs): class BillingPeriodsListResult(_serialization.Model): - """Result of listing billing periods. It contains a list of available billing periods in reverse chronological order. + """Result of listing billing periods. It contains a list of available billing periods in reverse + chronological order. Variables are only populated by the server, and will be ignored when sending a request. @@ -674,7 +675,7 @@ class BillingPeriodsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -702,7 +703,7 @@ class BillingPermissionsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -730,7 +731,7 @@ class BillingPermissionsProperties(_serialization.Model): "not_actions": {"key": "notActions", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.actions = None @@ -845,8 +846,8 @@ def __init__( enabled_azure_plans: Optional[List["_models.AzurePlan"]] = None, invoice_sections: Optional["_models.InvoiceSectionsOnExpand"] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the billing profile. :paramtype display_name: str @@ -920,8 +921,8 @@ def __init__( bill_to: Optional["_models.AddressDetails"] = None, invoice_email_opt_in: Optional[bool] = None, enabled_azure_plans: Optional[List["_models.AzurePlan"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the billing profile. :paramtype display_name: str @@ -946,7 +947,8 @@ def __init__( class BillingProfileInfo(_serialization.Model): - """Details about billing profile associated with agreement and available only for specific agreements. + """Details about billing profile associated with agreement and available only for specific + agreements. :ivar billing_profile_id: The unique identifier for the billing profile. :vartype billing_profile_id: str @@ -969,8 +971,8 @@ def __init__( billing_profile_id: Optional[str] = None, billing_profile_display_name: Optional[str] = None, indirect_relationship_organization_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword billing_profile_id: The unique identifier for the billing profile. :paramtype billing_profile_id: str @@ -1011,7 +1013,7 @@ class BillingProfileListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1020,7 +1022,8 @@ def __init__(self, **kwargs): class BillingProfilesOnExpand(_serialization.Model): - """The billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + """The billing profiles associated with the billing account. By default this is not populated, + unless it's specified in $expand. Variables are only populated by the server, and will be ignored when sending a request. @@ -1041,7 +1044,7 @@ class BillingProfilesOnExpand(_serialization.Model): "value": {"key": "value", "type": "[BillingProfile]"}, } - def __init__(self, *, value: Optional[List["_models.BillingProfile"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.BillingProfile"]] = None, **kwargs: Any) -> None: """ :keyword value: The billing profiles associated with the billing account. :paramtype value: list[~azure.mgmt.billing.models.BillingProfile] @@ -1155,7 +1158,7 @@ class BillingProperty(Resource): # pylint: disable=too-many-instance-attributes "sku_description": {"key": "properties.skuDescription", "type": "str"}, } - def __init__(self, *, cost_center: Optional[str] = None, **kwargs): + def __init__(self, *, cost_center: Optional[str] = None, **kwargs: Any) -> None: """ :keyword cost_center: The cost center applied to the subscription. :paramtype cost_center: str @@ -1250,8 +1253,8 @@ def __init__( role_definition_id: Optional[str] = None, user_authentication_type: Optional[str] = None, user_email_address: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword principal_id: The principal id of the user to whom the role was assigned. :paramtype principal_id: str @@ -1299,7 +1302,7 @@ class BillingRoleAssignmentListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1342,7 +1345,9 @@ class BillingRoleDefinition(Resource): "role_name": {"key": "properties.roleName", "type": "str"}, } - def __init__(self, *, permissions: Optional[List["_models.BillingPermissionsProperties"]] = None, **kwargs): + def __init__( + self, *, permissions: Optional[List["_models.BillingPermissionsProperties"]] = None, **kwargs: Any + ) -> None: """ :keyword permissions: The billingPermissions the role has. :paramtype permissions: list[~azure.mgmt.billing.models.BillingPermissionsProperties] @@ -1374,7 +1379,7 @@ class BillingRoleDefinitionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1480,8 +1485,8 @@ def __init__( subscription_billing_status: Optional[Union[str, "_models.BillingSubscriptionStatusType"]] = None, cost_center: Optional[str] = None, sku_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscription_billing_status: The current billing status of the subscription. Known values are: "Active", "Inactive", "Abandoned", "Deleted", and "Warning". @@ -1536,7 +1541,7 @@ class BillingSubscriptionsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1592,8 +1597,8 @@ def __init__( display_name: Optional[str] = None, enabled_azure_plans: Optional[List["_models.AzurePlan"]] = None, resellers: Optional[List["_models.Reseller"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the customer. :paramtype display_name: str @@ -1635,7 +1640,7 @@ class CustomerListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1672,7 +1677,7 @@ class CustomerPolicy(Resource): "view_charges": {"key": "properties.viewCharges", "type": "str"}, } - def __init__(self, *, view_charges: Optional[Union[str, "_models.ViewCharges"]] = None, **kwargs): + def __init__(self, *, view_charges: Optional[Union[str, "_models.ViewCharges"]] = None, **kwargs: Any) -> None: """ :keyword view_charges: The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Known values are: "Allowed" and "NotAllowed". @@ -1727,8 +1732,8 @@ def __init__( cost_center: Optional[str] = None, status: Optional[str] = None, enrollment_accounts: Optional[List["_models.EnrollmentAccount"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword department_name: The name of the department. :paramtype department_name: str @@ -1774,7 +1779,7 @@ class Document(_serialization.Model): "source": {"key": "source", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.kind = None @@ -1803,7 +1808,7 @@ class DownloadUrl(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.expiry_time = None @@ -1858,8 +1863,12 @@ class Enrollment(_serialization.Model): } def __init__( - self, *, start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None, **kwargs - ): + self, + *, + start_date: Optional[datetime.datetime] = None, + end_date: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """ :keyword start_date: The start date of the enrollment. :paramtype start_date: ~datetime.datetime @@ -1939,8 +1948,8 @@ def __init__( start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None, department: Optional["_models.Department"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword account_name: The name of the enrollment account. :paramtype account_name: str @@ -1998,8 +2007,8 @@ def __init__( start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None, enrollment_account_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cost_center: The cost center associated with the enrollment account. :paramtype cost_center: str @@ -2038,7 +2047,7 @@ class EnrollmentAccountListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2074,7 +2083,7 @@ class EnrollmentAccountSummary(Resource): "principal_name": {"key": "properties.principalName", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_name = None @@ -2113,7 +2122,7 @@ class EnrollmentPolicies(_serialization.Model): "reserved_instances_enabled": {"key": "reservedInstancesEnabled", "type": "bool"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.account_owner_view_charges = None @@ -2151,7 +2160,7 @@ class ErrorDetails(_serialization.Model): "details": {"key": "details", "type": "[ErrorSubDetailsItem]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -2161,7 +2170,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. :ivar error: The details of the error. :vartype error: ~azure.mgmt.billing.models.ErrorDetails @@ -2171,7 +2181,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetails"}, } - def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.billing.models.ErrorDetails @@ -2205,7 +2215,7 @@ class ErrorSubDetailsItem(_serialization.Model): "target": {"key": "target", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -2238,8 +2248,8 @@ def __init__( billing_account_name: Optional[str] = None, billing_profile_name: Optional[str] = None, display_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword billing_account_name: The billing account name of the partner or the customer for an indirect motion. @@ -2300,8 +2310,8 @@ def __init__( start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None, creation_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword amount: The amount budgeted for this billing instruction. :paramtype amount: float @@ -2340,7 +2350,7 @@ class InstructionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2488,7 +2498,7 @@ class Invoice(Resource): # pylint: disable=too-many-instance-attributes "subscription_id": {"key": "properties.subscriptionId", "type": "str"}, } - def __init__(self, **kwargs): # pylint: disable=too-many-locals + def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals """ """ super().__init__(**kwargs) self.due_date = None @@ -2543,7 +2553,7 @@ class InvoiceListResult(_serialization.Model): "total_count": {"key": "totalCount", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2608,8 +2618,8 @@ def __init__( display_name: Optional[str] = None, labels: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The name of the invoice section. :paramtype display_name: str @@ -2640,7 +2650,7 @@ class InvoiceSectionCreationRequest(_serialization.Model): "display_name": {"key": "displayName", "type": "str"}, } - def __init__(self, *, display_name: Optional[str] = None, **kwargs): + def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword display_name: The name of the invoice section. :paramtype display_name: str @@ -2674,7 +2684,7 @@ class InvoiceSectionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2702,7 +2712,9 @@ class InvoiceSectionListWithCreateSubPermissionResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.InvoiceSectionWithCreateSubPermission"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.InvoiceSectionWithCreateSubPermission"]] = None, **kwargs: Any + ) -> None: """ :keyword value: The list of invoice section properties with create subscription permission. :paramtype value: list[~azure.mgmt.billing.models.InvoiceSectionWithCreateSubPermission] @@ -2713,7 +2725,8 @@ def __init__(self, *, value: Optional[List["_models.InvoiceSectionWithCreateSubP class InvoiceSectionsOnExpand(_serialization.Model): - """The invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand. + """The invoice sections associated to the billing profile. By default this is not populated, + unless it's specified in $expand. Variables are only populated by the server, and will be ignored when sending a request. @@ -2734,7 +2747,7 @@ class InvoiceSectionsOnExpand(_serialization.Model): "value": {"key": "value", "type": "[InvoiceSection]"}, } - def __init__(self, *, value: Optional[List["_models.InvoiceSection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.InvoiceSection"]] = None, **kwargs: Any) -> None: """ :keyword value: The invoice sections associated to the billing profile. :paramtype value: list[~azure.mgmt.billing.models.InvoiceSection] @@ -2801,7 +2814,7 @@ class InvoiceSectionWithCreateSubPermission(_serialization.Model): "enabled_azure_plans": {"key": "enabledAzurePlans", "type": "[AzurePlan]"}, } - def __init__(self, *, enabled_azure_plans: Optional[List["_models.AzurePlan"]] = None, **kwargs): + def __init__(self, *, enabled_azure_plans: Optional[List["_models.AzurePlan"]] = None, **kwargs: Any) -> None: """ :keyword enabled_azure_plans: Enabled azure plans for the associated billing profile. :paramtype enabled_azure_plans: list[~azure.mgmt.billing.models.AzurePlan] @@ -2843,7 +2856,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: The object that represents the operation. :paramtype display: ~azure.mgmt.billing.models.OperationDisplay @@ -2884,7 +2897,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -2915,7 +2928,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2947,7 +2960,7 @@ class OperationsErrorDetails(_serialization.Model): "target": {"key": "target", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -2956,7 +2969,8 @@ def __init__(self, **kwargs): class OperationsErrorResponse(_serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. :ivar error: The details of the error. :vartype error: ~azure.mgmt.billing.models.OperationsErrorDetails @@ -2966,7 +2980,7 @@ class OperationsErrorResponse(_serialization.Model): "error": {"key": "error", "type": "OperationsErrorDetails"}, } - def __init__(self, *, error: Optional["_models.OperationsErrorDetails"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.OperationsErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.billing.models.OperationsErrorDetails @@ -3000,7 +3014,7 @@ class Participants(_serialization.Model): "email": {"key": "email", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None @@ -3041,7 +3055,9 @@ class PaymentProperties(_serialization.Model): "payment_method_type": {"key": "paymentMethodType", "type": "str"}, } - def __init__(self, *, payment_method_family: Optional[Union[str, "_models.PaymentMethodFamily"]] = None, **kwargs): + def __init__( + self, *, payment_method_family: Optional[Union[str, "_models.PaymentMethodFamily"]] = None, **kwargs: Any + ) -> None: """ :keyword payment_method_family: The family of payment method. Known values are: "Credits", "CheckWire", "CreditCard", and "None". @@ -3099,8 +3115,8 @@ def __init__( marketplace_purchases: Optional[Union[str, "_models.MarketplacePurchasesPolicy"]] = None, reservation_purchases: Optional[Union[str, "_models.ReservationPurchasesPolicy"]] = None, view_charges: Optional[Union[str, "_models.ViewChargesPolicy"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword marketplace_purchases: The policy that controls whether Azure marketplace purchases are allowed for a billing profile. Known values are: "AllAllowed", "OnlyFreeAllowed", and @@ -3242,8 +3258,8 @@ def __init__( # pylint: disable=too-many-locals auto_renew: Optional[Union[str, "_models.AutoRenew"]] = None, status: Optional[Union[str, "_models.ProductStatusType"]] = None, billing_frequency: Optional[Union[str, "_models.BillingFrequency"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword auto_renew: Indicates whether auto renewal is turned on or off for a product. Known values are: "Off" and "On". @@ -3281,7 +3297,8 @@ def __init__( # pylint: disable=too-many-locals class ProductsListResult(_serialization.Model): - """The list of products. It contains a list of available product summaries in reverse chronological order by purchase date. + """The list of products. It contains a list of available product summaries in reverse + chronological order by purchase date. Variables are only populated by the server, and will be ignored when sending a request. @@ -3305,7 +3322,7 @@ class ProductsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -3338,7 +3355,7 @@ class RebillDetails(_serialization.Model): "rebill_details": {"key": "rebillDetails", "type": "{RebillDetails}"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.credit_note_document_id = None @@ -3367,7 +3384,7 @@ class Reseller(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.reseller_id = None @@ -3482,8 +3499,8 @@ def __init__( *, sku: Optional["_models.ReservationSkuProperty"] = None, applied_scopes: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sku: The sku information associated to this reservation. :paramtype sku: ~azure.mgmt.billing.models.ReservationSkuProperty @@ -3536,7 +3553,9 @@ class ReservationPropertyUtilization(_serialization.Model): "aggregates": {"key": "aggregates", "type": "[ReservationUtilizationAggregates]"}, } - def __init__(self, *, aggregates: Optional[List["_models.ReservationUtilizationAggregates"]] = None, **kwargs): + def __init__( + self, *, aggregates: Optional[List["_models.ReservationUtilizationAggregates"]] = None, **kwargs: Any + ) -> None: """ :keyword aggregates: The array of aggregates of a reservation's utilization. :paramtype aggregates: list[~azure.mgmt.billing.models.ReservationUtilizationAggregates] @@ -3563,7 +3582,7 @@ class ReservationSkuProperty(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -3593,7 +3612,7 @@ class ReservationsListResult(_serialization.Model): "summary": {"key": "summary", "type": "ReservationSummary"}, } - def __init__(self, *, summary: Optional["_models.ReservationSummary"] = None, **kwargs): + def __init__(self, *, summary: Optional["_models.ReservationSummary"] = None, **kwargs: Any) -> None: """ :keyword summary: The roll out count summary of the reservations. :paramtype summary: ~azure.mgmt.billing.models.ReservationSummary @@ -3641,7 +3660,7 @@ class ReservationSummary(_serialization.Model): "cancelled_count": {"key": "cancelledCount", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.succeeded_count = None @@ -3681,7 +3700,7 @@ class ReservationUtilizationAggregates(_serialization.Model): "value_unit": {"key": "valueUnit", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.grain = None @@ -3881,8 +3900,8 @@ def __init__( # pylint: disable=too-many-locals *, kind: Optional[Union[str, "_models.TransactionTypeKind"]] = None, transaction_type: Optional[Union[str, "_models.ReservationType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: The kind of transaction. Options are all or reservation. Known values are: "all" and "reservation". @@ -3955,7 +3974,7 @@ class TransactionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -3980,7 +3999,7 @@ class TransferBillingSubscriptionRequestProperties(_serialization.Model): "destination_invoice_section_id": {"key": "destinationInvoiceSectionId", "type": "str"}, } - def __init__(self, *, destination_invoice_section_id: str, **kwargs): + def __init__(self, *, destination_invoice_section_id: str, **kwargs: Any) -> None: """ :keyword destination_invoice_section_id: The destination invoice section id. Required. :paramtype destination_invoice_section_id: str @@ -4000,7 +4019,7 @@ class TransferProductRequestProperties(_serialization.Model): "destination_invoice_section_id": {"key": "destinationInvoiceSectionId", "type": "str"}, } - def __init__(self, *, destination_invoice_section_id: Optional[str] = None, **kwargs): + def __init__(self, *, destination_invoice_section_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword destination_invoice_section_id: The destination invoice section id. :paramtype destination_invoice_section_id: str @@ -4032,8 +4051,8 @@ def __init__( status: Optional[Union[str, "_models.AddressValidationStatus"]] = None, suggested_addresses: Optional[List["_models.AddressDetails"]] = None, validation_message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: status of the address validation. Known values are: "Valid" and "Invalid". :paramtype status: str or ~azure.mgmt.billing.models.AddressValidationStatus @@ -4074,8 +4093,8 @@ def __init__( code: Optional[Union[str, "_models.ProductTransferValidationErrorCode"]] = None, message: Optional[str] = None, details: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Error code for the product transfer validation. Known values are: "InvalidSource", "ProductNotActive", "InsufficientPermissionOnSource", @@ -4114,7 +4133,9 @@ class ValidateProductTransferEligibilityResult(_serialization.Model): "error_details": {"key": "errorDetails", "type": "ValidateProductTransferEligibilityError"}, } - def __init__(self, *, error_details: Optional["_models.ValidateProductTransferEligibilityError"] = None, **kwargs): + def __init__( + self, *, error_details: Optional["_models.ValidateProductTransferEligibilityError"] = None, **kwargs: Any + ) -> None: """ :keyword error_details: Validation error details. :paramtype error_details: ~azure.mgmt.billing.models.ValidateProductTransferEligibilityError @@ -4154,8 +4175,8 @@ def __init__( code: Optional[Union[str, "_models.SubscriptionTransferValidationErrorCode"]] = None, message: Optional[str] = None, details: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: Error code for the product transfer validation. Known values are: "BillingAccountInactive", "CrossBillingAccountNotAllowed", "DestinationBillingProfileInactive", @@ -4198,8 +4219,8 @@ class ValidateSubscriptionTransferEligibilityResult(_serialization.Model): } def __init__( - self, *, error_details: Optional["_models.ValidateSubscriptionTransferEligibilityError"] = None, **kwargs - ): + self, *, error_details: Optional["_models.ValidateSubscriptionTransferEligibilityError"] = None, **kwargs: Any + ) -> None: """ :keyword error_details: Validation error details. :paramtype error_details: diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py index 0f9808051bfd..f2d294b6f93c 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/__init__.py @@ -29,7 +29,7 @@ from ._operations import Operations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py index 90c54ff85765..c110d4303d79 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_address_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,8 +38,8 @@ def build_validate_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,6 +82,9 @@ def validate( """Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param address: Required. :type address: ~azure.mgmt.billing.models.AddressDetails :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -105,6 +103,9 @@ def validate( """Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param address: Required. :type address: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -121,7 +122,10 @@ def validate(self, address: Union[_models.AddressDetails, IO], **kwargs: Any) -> """Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. - :param address: Is either a model type or a IO type. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + + :param address: Is either a AddressDetails type or a IO type. Required. :type address: ~azure.mgmt.billing.models.AddressDetails or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -142,9 +146,9 @@ def validate(self, address: Union[_models.AddressDetails, IO], **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateAddressResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateAddressResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -164,10 +168,11 @@ def validate(self, address: Union[_models.AddressDetails, IO], **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,4 +189,4 @@ def validate(self, address: Union[_models.AddressDetails, IO], **kwargs: Any) -> return deserialized - validate.metadata = {"url": "/providers/Microsoft.Billing/validateAddress"} # type: ignore + validate.metadata = {"url": "/providers/Microsoft.Billing/validateAddress"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py index 9af6e3f7244d..517a7a4545fe 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_agreements_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_list_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +50,7 @@ def build_list_by_billing_account_request( "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +69,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +81,7 @@ def build_get_request( "agreementName": _SERIALIZER.url("agreement_name", agreement_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,6 +119,9 @@ def list_by_billing_account( ) -> Iterable["_models.Agreement"]: """Lists the agreements for a billing account. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param expand: May be used to expand the participants. Default value is None. @@ -136,8 +134,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AgreementListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.AgreementListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -159,12 +157,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -172,14 +170,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AgreementListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -192,7 +191,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements" + } @distributed_trace def get( @@ -200,6 +201,9 @@ def get( ) -> _models.Agreement: """Gets an agreement by ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param agreement_name: The ID that uniquely identifies an agreement. Required. @@ -222,8 +226,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Agreement] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Agreement] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -235,10 +239,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,4 +260,6 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py index 26e000582157..021f7665599b 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_available_balances_operations.py @@ -6,7 +6,6 @@ # 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 ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_get_request(billing_account_name: str, billing_profile_name: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +51,7 @@ def build_get_request(billing_account_name: str, billing_profile_name: str, **kw "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,6 +87,9 @@ def get(self, billing_account_name: str, billing_profile_name: str, **kwargs: An pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -112,8 +110,8 @@ def get(self, billing_account_name: str, billing_profile_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailableBalance] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.AvailableBalance] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -124,10 +122,11 @@ def get(self, billing_account_name: str, billing_profile_name: str, **kwargs: An params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,4 +143,6 @@ def get(self, billing_account_name: str, billing_profile_name: str, **kwargs: An return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py index aee34a48ab82..da24d06ef465 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_accounts_operations.py @@ -6,7 +6,6 @@ # 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, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_list_request(*, expand: Optional[str] = None, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +62,7 @@ def build_get_request(billing_account_name: str, *, expand: Optional[str] = None _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +71,7 @@ def build_get_request(billing_account_name: str, *, expand: Optional[str] = None "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,8 +88,8 @@ def build_update_request(billing_account_name: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +98,7 @@ def build_update_request(billing_account_name: str, **kwargs: Any) -> HttpReques "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,13 +111,13 @@ def build_update_request(billing_account_name: str, **kwargs: Any) -> HttpReques return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_invoice_sections_by_create_subscription_permission_request( +def build_list_invoice_sections_by_create_subscription_permission_request( # pylint: disable=name-too-long billing_account_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +129,7 @@ def build_list_invoice_sections_by_create_subscription_permission_request( "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,6 +163,9 @@ def __init__(self, *args, **kwargs): def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models.BillingAccount"]: """Lists the billing accounts that a user has access to. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param expand: May be used to expand the soldTo, invoice sections and billing profiles. Default value is None. :type expand: str @@ -179,8 +177,8 @@ def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -201,12 +199,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,14 +212,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,12 +233,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts"} @distributed_trace def get(self, billing_account_name: str, expand: Optional[str] = None, **kwargs: Any) -> _models.BillingAccount: """Gets a billing account by its ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param expand: May be used to expand the soldTo, invoice sections and billing profiles. Default @@ -261,8 +263,8 @@ def get(self, billing_account_name: str, expand: Optional[str] = None, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingAccount] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingAccount] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -273,10 +275,11 @@ def get(self, billing_account_name: str, expand: Optional[str] = None, **kwargs: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,7 +296,7 @@ def get(self, billing_account_name: str, expand: Optional[str] = None, **kwargs: return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} def _update_initial( self, billing_account_name: str, parameters: Union[_models.BillingAccountUpdateRequest, IO], **kwargs: Any @@ -309,9 +312,9 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BillingAccount]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BillingAccount]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -332,10 +335,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -354,7 +358,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} # type: ignore + _update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} @overload def begin_update( @@ -432,7 +436,7 @@ def begin_update( :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the update billing account - operation. Is either a model type or a IO type. Required. + operation. Is either a BillingAccountUpdateRequest type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.BillingAccountUpdateRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -453,14 +457,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingAccount] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingAccount] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( billing_account_name=billing_account_name, parameters=parameters, api_version=api_version, @@ -479,9 +483,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -493,18 +497,21 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} # type: ignore + begin_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}"} @distributed_trace - def list_invoice_sections_by_create_subscription_permission( + def list_invoice_sections_by_create_subscription_permission( # pylint: disable=name-too-long self, billing_account_name: str, **kwargs: Any ) -> Iterable["_models.InvoiceSectionWithCreateSubPermission"]: """Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -517,8 +524,8 @@ def list_invoice_sections_by_create_subscription_permission( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSectionListWithCreateSubPermissionResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceSectionListWithCreateSubPermissionResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -539,12 +546,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -552,14 +559,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceSectionListWithCreateSubPermissionResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -572,4 +580,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_invoice_sections_by_create_subscription_permission.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission"} # type: ignore + list_invoice_sections_by_create_subscription_permission.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_periods_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_periods_operations.py index a3907caf1a84..9ff064d09264 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_periods_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_periods_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,9 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +55,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,9 +76,7 @@ def build_get_request(billing_period_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +88,7 @@ def build_get_request(billing_period_name: str, subscription_id: str, **kwargs: "billingPeriodName": _SERIALIZER.url("billing_period_name", billing_period_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,6 +126,9 @@ def list( only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + .. seealso:: + - https://go.microsoft.com/fwlink/?linkid=844490 + :param filter: May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Default value is None. @@ -155,10 +149,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPeriodsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.BillingPeriodsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -182,12 +174,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -195,14 +187,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingPeriodsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -215,7 +208,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods"} @distributed_trace def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingPeriod: @@ -241,10 +234,8 @@ def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingPeriod: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPeriod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.BillingPeriod] = kwargs.pop("cls", None) request = build_get_request( billing_period_name=billing_period_name, @@ -255,10 +246,11 @@ def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingPeriod: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -275,4 +267,6 @@ def get(self, billing_period_name: str, **kwargs: Any) -> _models.BillingPeriod: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py index 23b0e9fae31e..6b657ecb011a 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_permissions_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +39,7 @@ def build_list_by_customer_request(billing_account_name: str, customer_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,7 @@ def build_list_by_customer_request(billing_account_name: str, customer_name: str "customerName": _SERIALIZER.url("customer_name", customer_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +67,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +78,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +95,7 @@ def build_list_by_invoice_sections_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +109,7 @@ def build_list_by_invoice_sections_request( "invoiceSectionName": _SERIALIZER.url("invoice_section_name", invoice_section_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +126,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +139,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -180,6 +175,9 @@ def list_by_customer( ) -> Iterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has for a customer. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -193,8 +191,8 @@ def list_by_customer( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -216,12 +214,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -229,14 +227,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -249,7 +248,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions"} # type: ignore + list_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions" + } @distributed_trace def list_by_billing_account( @@ -257,6 +258,9 @@ def list_by_billing_account( ) -> Iterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has on a billing account. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -268,8 +272,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -290,12 +294,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -303,14 +307,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,7 +328,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions" + } @distributed_trace def list_by_invoice_sections( @@ -331,6 +338,9 @@ def list_by_invoice_sections( ) -> Iterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has on an invoice section. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -346,8 +356,8 @@ def list_by_invoice_sections( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -370,12 +380,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -383,14 +393,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,7 +414,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_invoice_sections.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions"} # type: ignore + list_by_invoice_sections.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions" + } @distributed_trace def list_by_billing_profile( @@ -411,6 +424,9 @@ def list_by_billing_profile( ) -> Iterable["_models.BillingPermissionsProperties"]: """Lists the billing permissions the caller has on a billing profile. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -424,8 +440,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingPermissionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingPermissionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -447,12 +463,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -460,14 +476,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingPermissionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,4 +497,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py index 71907f4a0bec..60a3d953db51 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_profiles_operations.py @@ -6,7 +6,6 @@ # 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, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +43,7 @@ def build_list_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_list_by_billing_account_request( "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +86,7 @@ def build_get_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +103,8 @@ def build_create_or_update_request(billing_account_name: str, billing_profile_na _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +117,7 @@ def build_create_or_update_request(billing_account_name: str, billing_profile_na "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,6 +156,9 @@ def list_by_billing_account( """Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param expand: May be used to expand the invoice sections. Default value is None. @@ -173,8 +171,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProfileListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingProfileListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,12 +194,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,14 +207,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingProfileListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -229,7 +228,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles" + } @distributed_trace def get( @@ -238,6 +239,9 @@ def get( """Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -260,8 +264,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProfile] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingProfile] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -273,10 +277,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,7 +298,9 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + } def _create_or_update_initial( self, @@ -313,9 +320,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BillingProfile]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BillingProfile]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -337,10 +344,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,7 +372,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + } @overload def begin_create_or_update( @@ -453,8 +463,8 @@ def begin_create_or_update( :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. :type billing_profile_name: str - :param parameters: The new or updated billing profile. Is either a model type or a IO type. - Required. + :param parameters: The new or updated billing profile. Is either a BillingProfile type or a IO + type. Required. :type parameters: ~azure.mgmt.billing.models.BillingProfile or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -475,14 +485,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProfile] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, parameters=parameters, @@ -502,7 +512,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -514,6 +524,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py index 743535f85e92..033578a53953 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_property_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +49,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,8 +64,8 @@ def build_update_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +76,7 @@ def build_update_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,6 +113,9 @@ def get(self, **kwargs: Any) -> _models.BillingProperty: """Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :keyword callable cls: A custom type or function that will be passed the direct response :return: BillingProperty or the result of cls(response) :rtype: ~azure.mgmt.billing.models.BillingProperty @@ -134,8 +132,8 @@ def get(self, **kwargs: Any) -> _models.BillingProperty: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProperty] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingProperty] = kwargs.pop("cls", None) request = build_get_request( subscription_id=self._config.subscription_id, @@ -145,10 +143,11 @@ def get(self, **kwargs: Any) -> _models.BillingProperty: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,7 +164,7 @@ def get(self, **kwargs: Any) -> _models.BillingProperty: return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} @overload def update( @@ -214,7 +213,7 @@ def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: Any) Agreement. :param parameters: Request parameters that are provided to the update billing property - operation. Is either a model type or a IO type. Required. + operation. Is either a BillingProperty type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.BillingProperty or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -235,9 +234,9 @@ def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingProperty] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -258,10 +257,11 @@ def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: Any) params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -278,4 +278,4 @@ def update(self, parameters: Union[_models.BillingProperty, IO], **kwargs: Any) return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py index b83b71d584c5..819a74cb462a 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_assignments_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_get_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_get_by_billing_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +73,7 @@ def build_delete_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +88,7 @@ def build_delete_by_billing_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +109,7 @@ def build_get_by_invoice_section_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +126,7 @@ def build_get_by_invoice_section_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +147,7 @@ def build_delete_by_invoice_section_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +164,7 @@ def build_delete_by_invoice_section_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,7 +181,7 @@ def build_get_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +197,7 @@ def build_get_by_billing_profile_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +214,7 @@ def build_delete_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +230,7 @@ def build_delete_by_billing_profile_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -250,7 +245,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -261,7 +256,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -278,7 +273,7 @@ def build_list_by_invoice_section_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,7 +287,7 @@ def build_list_by_invoice_section_request( "invoiceSectionName": _SERIALIZER.url("invoice_section_name", invoice_section_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -309,7 +304,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -322,7 +317,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -360,6 +355,9 @@ def get_by_billing_account( billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_role_assignment_name: The ID that uniquely identifies a role assignment. @@ -381,8 +379,8 @@ def get_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_get_by_billing_account_request( billing_account_name=billing_account_name, @@ -393,10 +391,11 @@ def get_by_billing_account( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +412,9 @@ def get_by_billing_account( return deserialized - get_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + get_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace def delete_by_billing_account( @@ -444,8 +445,8 @@ def delete_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_delete_by_billing_account_request( billing_account_name=billing_account_name, @@ -456,10 +457,11 @@ def delete_by_billing_account( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -476,7 +478,9 @@ def delete_by_billing_account( return deserialized - delete_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + delete_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace def get_by_invoice_section( @@ -490,6 +494,9 @@ def get_by_invoice_section( """Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -515,8 +522,8 @@ def get_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_get_by_invoice_section_request( billing_account_name=billing_account_name, @@ -529,10 +536,11 @@ def get_by_invoice_section( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -549,7 +557,9 @@ def get_by_invoice_section( return deserialized - get_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + get_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace def delete_by_invoice_section( @@ -588,8 +598,8 @@ def delete_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_delete_by_invoice_section_request( billing_account_name=billing_account_name, @@ -602,10 +612,11 @@ def delete_by_invoice_section( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -622,7 +633,9 @@ def delete_by_invoice_section( return deserialized - delete_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + delete_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace def get_by_billing_profile( @@ -632,6 +645,9 @@ def get_by_billing_profile( billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -655,8 +671,8 @@ def get_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_get_by_billing_profile_request( billing_account_name=billing_account_name, @@ -668,10 +684,11 @@ def get_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,7 +705,9 @@ def get_by_billing_profile( return deserialized - get_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + get_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace def delete_by_billing_profile( @@ -721,8 +740,8 @@ def delete_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignment] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignment] = kwargs.pop("cls", None) request = build_delete_by_billing_profile_request( billing_account_name=billing_account_name, @@ -734,10 +753,11 @@ def delete_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,7 +774,9 @@ def delete_by_billing_profile( return deserialized - delete_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}"} # type: ignore + delete_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}" + } @distributed_trace def list_by_billing_account( @@ -764,6 +786,9 @@ def list_by_billing_account( billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -775,8 +800,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignmentListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -797,12 +822,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -810,14 +835,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -830,7 +856,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments" + } @distributed_trace def list_by_invoice_section( @@ -839,6 +867,9 @@ def list_by_invoice_section( """Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -854,8 +885,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignmentListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -878,12 +909,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -891,14 +922,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -911,7 +943,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments" + } @distributed_trace def list_by_billing_profile( @@ -920,6 +954,9 @@ def list_by_billing_profile( """Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -933,8 +970,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleAssignmentListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleAssignmentListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -956,12 +993,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -969,14 +1006,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -989,4 +1027,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py index a12bedcc72c9..36bb05470b95 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_role_definitions_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_get_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_get_by_billing_account_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +77,7 @@ def build_get_by_invoice_section_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +94,7 @@ def build_get_by_invoice_section_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +111,7 @@ def build_get_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +127,7 @@ def build_get_by_billing_profile_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +142,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +153,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +170,7 @@ def build_list_by_invoice_section_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +184,7 @@ def build_list_by_invoice_section_request( "invoiceSectionName": _SERIALIZER.url("invoice_section_name", invoice_section_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +201,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -219,7 +214,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -256,6 +251,9 @@ def get_by_billing_account( """Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_role_definition_name: The ID that uniquely identifies a role definition. @@ -277,8 +275,8 @@ def get_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinition] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinition] = kwargs.pop("cls", None) request = build_get_by_billing_account_request( billing_account_name=billing_account_name, @@ -289,10 +287,11 @@ def get_by_billing_account( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,7 +308,9 @@ def get_by_billing_account( return deserialized - get_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}"} # type: ignore + get_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}" + } @distributed_trace def get_by_invoice_section( @@ -323,6 +324,9 @@ def get_by_invoice_section( """Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -348,8 +352,8 @@ def get_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinition] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinition] = kwargs.pop("cls", None) request = build_get_by_invoice_section_request( billing_account_name=billing_account_name, @@ -362,10 +366,11 @@ def get_by_invoice_section( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,7 +387,9 @@ def get_by_invoice_section( return deserialized - get_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}"} # type: ignore + get_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}" + } @distributed_trace def get_by_billing_profile( @@ -391,6 +398,9 @@ def get_by_billing_profile( """Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -414,8 +424,8 @@ def get_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinition] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinition] = kwargs.pop("cls", None) request = build_get_by_billing_profile_request( billing_account_name=billing_account_name, @@ -427,10 +437,11 @@ def get_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -447,7 +458,9 @@ def get_by_billing_profile( return deserialized - get_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}"} # type: ignore + get_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}" + } @distributed_trace def list_by_billing_account( @@ -456,6 +469,9 @@ def list_by_billing_account( """Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -467,8 +483,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinitionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -489,12 +505,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -502,14 +518,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,7 +539,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions" + } @distributed_trace def list_by_invoice_section( @@ -531,6 +550,9 @@ def list_by_invoice_section( """Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -546,8 +568,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinitionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -570,12 +592,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -583,14 +605,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,7 +626,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions" + } @distributed_trace def list_by_billing_profile( @@ -612,6 +637,9 @@ def list_by_billing_profile( """Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -625,8 +653,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingRoleDefinitionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingRoleDefinitionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -648,12 +676,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -661,14 +689,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingRoleDefinitionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,4 +710,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_subscriptions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_subscriptions_operations.py index aee7b07c6d12..f4b9de590c12 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_subscriptions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_billing_subscriptions_operations.py @@ -6,7 +6,6 @@ # 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, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_list_by_customer_request(billing_account_name: str, customer_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_list_by_customer_request(billing_account_name: str, customer_name: str "customerName": _SERIALIZER.url("customer_name", customer_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +69,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +80,7 @@ def build_list_by_billing_account_request(billing_account_name: str, **kwargs: A "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +97,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +110,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,7 +127,7 @@ def build_list_by_invoice_section_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +141,7 @@ def build_list_by_invoice_section_request( "invoiceSectionName": _SERIALIZER.url("invoice_section_name", invoice_section_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,7 +156,7 @@ def build_get_request(billing_account_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +169,7 @@ def build_get_request(billing_account_name: str, subscription_id: str, **kwargs: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -189,8 +184,8 @@ def build_update_request(billing_account_name: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +198,7 @@ def build_update_request(billing_account_name: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,8 +215,8 @@ def build_move_request(billing_account_name: str, subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +229,7 @@ def build_move_request(billing_account_name: str, subscription_id: str, **kwargs "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -251,8 +246,8 @@ def build_validate_move_request(billing_account_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -265,7 +260,7 @@ def build_validate_move_request(billing_account_name: str, subscription_id: str, "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -304,6 +299,9 @@ def list_by_customer( """Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -316,8 +314,8 @@ def list_by_customer( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -339,12 +337,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -352,14 +350,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,7 +371,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions"} # type: ignore + list_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions" + } @distributed_trace def list_by_billing_account( @@ -381,6 +382,9 @@ def list_by_billing_account( """Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -391,8 +395,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -413,12 +417,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -426,14 +430,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -446,7 +451,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions" + } @distributed_trace def list_by_billing_profile( @@ -456,6 +463,9 @@ def list_by_billing_profile( billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -468,8 +478,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -491,12 +501,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -504,14 +514,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,7 +535,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions" + } @distributed_trace def list_by_invoice_section( @@ -533,6 +546,9 @@ def list_by_invoice_section( """Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -547,8 +563,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscriptionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscriptionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -571,12 +587,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -584,14 +600,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BillingSubscriptionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,13 +621,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions" + } @distributed_trace def get(self, billing_account_name: str, **kwargs: Any) -> _models.BillingSubscription: """Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -629,8 +651,8 @@ def get(self, billing_account_name: str, **kwargs: Any) -> _models.BillingSubscr _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscription] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.BillingSubscription] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -641,10 +663,11 @@ def get(self, billing_account_name: str, **kwargs: Any) -> _models.BillingSubscr params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,7 +684,9 @@ def get(self, billing_account_name: str, **kwargs: Any) -> _models.BillingSubscr return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}" + } @overload def update( @@ -723,7 +748,7 @@ def update( :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the update billing subscription - operation. Is either a model type or a IO type. Required. + operation. Is either a BillingSubscription type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.BillingSubscription or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -744,9 +769,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscription] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingSubscription] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -768,10 +793,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -788,7 +814,9 @@ def update( return deserialized - update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}"} # type: ignore + update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}" + } def _move_initial( self, @@ -807,9 +835,9 @@ def _move_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.BillingSubscription]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BillingSubscription]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -831,10 +859,11 @@ def _move_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -858,7 +887,9 @@ def _move_initial( return deserialized - _move_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move"} # type: ignore + _move_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move" + } @overload def begin_move( @@ -873,6 +904,9 @@ def begin_move( the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the move subscription operation. @@ -903,6 +937,9 @@ def begin_move( the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the move subscription operation. @@ -936,10 +973,13 @@ def begin_move( the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the move subscription operation. Is - either a model type or a IO type. Required. + either a TransferBillingSubscriptionRequestProperties type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.TransferBillingSubscriptionRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -960,14 +1000,14 @@ def begin_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingSubscription] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BillingSubscription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._move_initial( # type: ignore + raw_result = self._move_initial( billing_account_name=billing_account_name, parameters=parameters, api_version=api_version, @@ -986,7 +1026,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -998,9 +1038,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move"} # type: ignore + begin_move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move" + } @overload def validate_move( @@ -1014,6 +1056,9 @@ def validate_move( """Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the validate move eligibility @@ -1035,6 +1080,9 @@ def validate_move( """Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the validate move eligibility @@ -1059,10 +1107,14 @@ def validate_move( """Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param parameters: Request parameters that are provided to the validate move eligibility - operation. Is either a model type or a IO type. Required. + operation. Is either a TransferBillingSubscriptionRequestProperties type or a IO type. + Required. :type parameters: ~azure.mgmt.billing.models.TransferBillingSubscriptionRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1083,9 +1135,9 @@ def validate_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateSubscriptionTransferEligibilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateSubscriptionTransferEligibilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1107,10 +1159,11 @@ def validate_move( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1127,4 +1180,6 @@ def validate_move( return deserialized - validate_move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility"} # type: ignore + validate_move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py index 4f17e3185617..2ed0d9d328f8 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_customers_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +80,7 @@ def build_list_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +89,7 @@ def build_list_by_billing_account_request( "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,7 +110,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +122,7 @@ def build_get_request( "customerName": _SERIALIZER.url("customer_name", customer_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,6 +166,9 @@ def list_by_billing_profile( """Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -188,8 +186,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.CustomerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -213,12 +211,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -226,14 +224,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,7 +245,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers" + } @distributed_trace def list_by_billing_account( @@ -255,6 +256,9 @@ def list_by_billing_account( """Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param search: Used for searching customers by their name. Any customer with name containing @@ -270,8 +274,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.CustomerListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -294,12 +298,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -307,14 +311,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomerListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,7 +332,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers" + } @distributed_trace def get( @@ -336,6 +343,9 @@ def get( """Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -358,8 +368,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Customer] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Customer] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -371,10 +381,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -391,4 +402,4 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py index 42d8040c9be3..361b4c3c46de 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_enrollment_accounts_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,9 +39,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,9 +58,7 @@ def build_get_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +67,7 @@ def build_get_request(name: str, **kwargs: Any) -> HttpRequest: "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,10 +110,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.EnrollmentAccountSummary"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrollmentAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.EnrollmentAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -142,12 +131,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -155,14 +144,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EnrollmentAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,7 +165,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts"} @distributed_trace def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummary: @@ -199,10 +189,8 @@ def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummary: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2018-03-01-preview") - ) # type: Literal["2018-03-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EnrollmentAccountSummary] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) + cls: ClsType[_models.EnrollmentAccountSummary] = kwargs.pop("cls", None) request = build_get_request( name=name, @@ -212,10 +200,11 @@ def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummary: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,4 +221,4 @@ def get(self, name: str, **kwargs: Any) -> _models.EnrollmentAccountSummary: return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts/{name}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/enrollmentAccounts/{name}"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_instructions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_instructions_operations.py index f62fedec3378..d97755c899d3 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_instructions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_instructions_operations.py @@ -6,7 +6,6 @@ # 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, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +41,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +71,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +85,7 @@ def build_get_request( "instructionName": _SERIALIZER.url("instruction_name", instruction_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,8 +102,8 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +117,7 @@ def build_put_request( "instructionName": _SERIALIZER.url("instruction_name", instruction_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,6 +155,9 @@ def list_by_billing_profile( ) -> Iterable["_models.Instruction"]: """Lists the instructions by billing profile id. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -172,8 +170,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InstructionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InstructionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -195,12 +193,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -208,14 +206,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InstructionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -228,7 +227,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions" + } @distributed_trace def get( @@ -237,6 +238,9 @@ def get( """Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -259,8 +263,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Instruction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Instruction] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -272,10 +276,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -292,7 +297,9 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}" + } @overload def put( @@ -374,7 +381,7 @@ def put( :type billing_profile_name: str :param instruction_name: Instruction Name. Required. :type instruction_name: str - :param parameters: The new instruction. Is either a model type or a IO type. Required. + :param parameters: The new instruction. Is either a Instruction type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.Instruction or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -395,9 +402,9 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Instruction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Instruction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -420,10 +427,11 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -440,4 +448,6 @@ def put( return deserialized - put.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}"} # type: ignore + put.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py index b55b2713334b..e591150926a6 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoice_sections_operations.py @@ -6,7 +6,6 @@ # 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, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +43,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +87,7 @@ def build_get_request( "invoiceSectionName": _SERIALIZER.url("invoice_section_name", invoice_section_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,8 +104,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +119,7 @@ def build_create_or_update_request( "invoiceSectionName": _SERIALIZER.url("invoice_section_name", invoice_section_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,6 +158,9 @@ def list_by_billing_profile( """Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -175,8 +173,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSectionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceSectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -198,12 +196,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -211,14 +209,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceSectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -231,7 +230,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections" + } @distributed_trace def get( @@ -240,6 +241,9 @@ def get( """Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -262,8 +266,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceSection] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -275,10 +279,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,7 +300,9 @@ def get( return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}"} # type: ignore + get.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" + } def _create_or_update_initial( self, @@ -316,9 +323,9 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.InvoiceSection]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.InvoiceSection]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -341,10 +348,11 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -368,7 +376,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" + } @overload def begin_create_or_update( @@ -466,8 +476,8 @@ def begin_create_or_update( :type billing_profile_name: str :param invoice_section_name: The ID that uniquely identifies an invoice section. Required. :type invoice_section_name: str - :param parameters: The new or updated invoice section. Is either a model type or a IO type. - Required. + :param parameters: The new or updated invoice section. Is either a InvoiceSection type or a IO + type. Required. :type parameters: ~azure.mgmt.billing.models.InvoiceSection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -488,14 +498,14 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceSection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.InvoiceSection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, invoice_section_name=invoice_section_name, @@ -516,7 +526,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -528,6 +538,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py index 87af03399778..4172a7ea721b 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_invoices_operations.py @@ -6,7 +6,6 @@ # 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, IO, Iterable, List, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -31,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +43,7 @@ def build_list_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,7 @@ def build_list_by_billing_account_request( "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +71,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +84,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,7 +101,7 @@ def build_get_request(billing_account_name: str, invoice_name: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +113,7 @@ def build_get_request(billing_account_name: str, invoice_name: str, **kwargs: An "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +128,7 @@ def build_get_by_id_request(invoice_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +137,7 @@ def build_get_by_id_request(invoice_name: str, **kwargs: Any) -> HttpRequest: "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +154,7 @@ def build_download_invoice_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +167,7 @@ def build_download_invoice_request( "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,12 +179,14 @@ def build_download_invoice_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_download_multiple_billing_profile_invoices_request(billing_account_name: str, **kwargs: Any) -> HttpRequest: +def build_download_multiple_billing_profile_invoices_request( # pylint: disable=name-too-long + billing_account_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +197,7 @@ def build_download_multiple_billing_profile_invoices_request(billing_account_nam "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,13 +210,13 @@ def build_download_multiple_billing_profile_invoices_request(billing_account_nam return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_billing_subscription_request( +def build_list_by_billing_subscription_request( # pylint: disable=name-too-long subscription_id: str, *, period_start_date: str, period_end_date: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +228,7 @@ def build_list_by_billing_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["periodStartDate"] = _SERIALIZER.query("period_start_date", period_start_date, "str") @@ -244,13 +241,13 @@ def build_list_by_billing_subscription_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_by_subscription_and_invoice_id_request( +def build_get_by_subscription_and_invoice_id_request( # pylint: disable=name-too-long invoice_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +260,7 @@ def build_get_by_subscription_and_invoice_id_request( "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -274,13 +271,13 @@ def build_get_by_subscription_and_invoice_id_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_download_billing_subscription_invoice_request( +def build_download_billing_subscription_invoice_request( # pylint: disable=name-too-long invoice_name: str, subscription_id: str, *, download_token: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -293,7 +290,7 @@ def build_download_billing_subscription_invoice_request( "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -305,12 +302,14 @@ def build_download_billing_subscription_invoice_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_download_multiple_billing_subscription_invoices_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_download_multiple_billing_subscription_invoices_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 {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -322,7 +321,7 @@ def build_download_multiple_billing_subscription_invoices_request(subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,6 +361,9 @@ def list_by_billing_account( supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param period_start_date: The start date to fetch the invoices. The date should be specified in @@ -378,8 +380,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -402,12 +404,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -415,14 +417,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,7 +438,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices" + } @distributed_trace def list_by_billing_profile( @@ -450,6 +455,9 @@ def list_by_billing_profile( supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -468,8 +476,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -493,12 +501,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -506,14 +514,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -526,13 +535,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices" + } @distributed_trace def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) -> _models.Invoice: """Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param invoice_name: The ID that uniquely identifies an invoice. Required. @@ -553,8 +567,8 @@ def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Invoice] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Invoice] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -565,10 +579,11 @@ def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,13 +600,16 @@ def get(self, billing_account_name: str, invoice_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}"} @distributed_trace def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: """Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param invoice_name: The ID that uniquely identifies an invoice. Required. :type invoice_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -610,8 +628,8 @@ def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Invoice] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Invoice] = kwargs.pop("cls", None) request = build_get_by_id_request( invoice_name=invoice_name, @@ -621,10 +639,11 @@ def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -641,7 +660,7 @@ def get_by_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: return deserialized - get_by_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}"} # type: ignore + get_by_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}"} def _download_invoice_initial( self, billing_account_name: str, invoice_name: str, download_token: str, **kwargs: Any @@ -657,8 +676,8 @@ def _download_invoice_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) request = build_download_invoice_request( billing_account_name=billing_account_name, @@ -670,10 +689,11 @@ def _download_invoice_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -697,7 +717,9 @@ def _download_invoice_initial( return deserialized - _download_invoice_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download"} # type: ignore + _download_invoice_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download" + } @distributed_trace def begin_download_invoice( @@ -706,6 +728,9 @@ def begin_download_invoice( """Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param invoice_name: The ID that uniquely identifies an invoice. Required. @@ -728,13 +753,13 @@ def begin_download_invoice( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._download_invoice_initial( # type: ignore + raw_result = self._download_invoice_initial( billing_account_name=billing_account_name, invoice_name=invoice_name, download_token=download_token, @@ -753,9 +778,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -767,11 +792,13 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_invoice.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download"} # type: ignore + begin_download_invoice.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download" + } - def _download_multiple_billing_profile_invoices_initial( + def _download_multiple_billing_profile_invoices_initial( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: Union[List[str], IO], **kwargs: Any ) -> Optional[_models.DownloadUrl]: error_map = { @@ -785,9 +812,9 @@ def _download_multiple_billing_profile_invoices_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -808,10 +835,11 @@ def _download_multiple_billing_profile_invoices_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -835,10 +863,12 @@ def _download_multiple_billing_profile_invoices_initial( return deserialized - _download_multiple_billing_profile_invoices_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments"} # type: ignore + _download_multiple_billing_profile_invoices_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments" + } @overload - def begin_download_multiple_billing_profile_invoices( + def begin_download_multiple_billing_profile_invoices( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: List[str], @@ -850,6 +880,9 @@ def begin_download_multiple_billing_profile_invoices( a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param download_urls: An array of download urls for individual documents. Required. @@ -872,13 +905,16 @@ def begin_download_multiple_billing_profile_invoices( """ @overload - def begin_download_multiple_billing_profile_invoices( + def begin_download_multiple_billing_profile_invoices( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: IO, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param download_urls: An array of download urls for individual documents. Required. @@ -901,17 +937,20 @@ def begin_download_multiple_billing_profile_invoices( """ @distributed_trace - def begin_download_multiple_billing_profile_invoices( + def begin_download_multiple_billing_profile_invoices( # pylint: disable=name-too-long self, billing_account_name: str, download_urls: Union[List[str], IO], **kwargs: Any ) -> LROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str - :param download_urls: An array of download urls for individual documents. Is either a list type - or a IO type. Required. + :param download_urls: An array of download urls for individual documents. Is either a [str] + type or a IO type. Required. :type download_urls: list[str] or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -932,14 +971,14 @@ def begin_download_multiple_billing_profile_invoices( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._download_multiple_billing_profile_invoices_initial( # type: ignore + raw_result = self._download_multiple_billing_profile_invoices_initial( billing_account_name=billing_account_name, download_urls=download_urls, api_version=api_version, @@ -958,9 +997,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -972,9 +1011,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_multiple_billing_profile_invoices.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments"} # type: ignore + begin_download_multiple_billing_profile_invoices.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments" + } @distributed_trace def list_by_billing_subscription( @@ -982,6 +1023,9 @@ def list_by_billing_subscription( ) -> Iterable["_models.Invoice"]: """Lists the invoices for a subscription. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param period_start_date: Invoice period start date. Required. :type period_start_date: str :param period_end_date: Invoice period end date. Required. @@ -994,8 +1038,8 @@ def list_by_billing_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.InvoiceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.InvoiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1018,12 +1062,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1031,14 +1075,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("InvoiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1051,12 +1096,17 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_subscription.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices"} # type: ignore + list_by_billing_subscription.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices" + } @distributed_trace def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: Any) -> _models.Invoice: """Gets an invoice by subscription ID and invoice ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param invoice_name: The ID that uniquely identifies an invoice. Required. :type invoice_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1075,8 +1125,8 @@ def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Invoice] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Invoice] = kwargs.pop("cls", None) request = build_get_by_subscription_and_invoice_id_request( invoice_name=invoice_name, @@ -1087,10 +1137,11 @@ def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: Any) - params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1107,9 +1158,11 @@ def get_by_subscription_and_invoice_id(self, invoice_name: str, **kwargs: Any) - return deserialized - get_by_subscription_and_invoice_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}"} # type: ignore + get_by_subscription_and_invoice_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}" + } - def _download_billing_subscription_invoice_initial( + def _download_billing_subscription_invoice_initial( # pylint: disable=name-too-long self, invoice_name: str, download_token: str, **kwargs: Any ) -> Optional[_models.DownloadUrl]: error_map = { @@ -1123,8 +1176,8 @@ def _download_billing_subscription_invoice_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) request = build_download_billing_subscription_invoice_request( invoice_name=invoice_name, @@ -1136,10 +1189,11 @@ def _download_billing_subscription_invoice_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1163,14 +1217,19 @@ def _download_billing_subscription_invoice_initial( return deserialized - _download_billing_subscription_invoice_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download"} # type: ignore + _download_billing_subscription_invoice_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download" + } @distributed_trace - def begin_download_billing_subscription_invoice( + def begin_download_billing_subscription_invoice( # pylint: disable=name-too-long self, invoice_name: str, download_token: str, **kwargs: Any ) -> LROPoller[_models.DownloadUrl]: """Gets a URL to download an invoice. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param invoice_name: The ID that uniquely identifies an invoice. Required. :type invoice_name: str :param download_token: Download token with document source and document ID. Required. @@ -1191,13 +1250,13 @@ def begin_download_billing_subscription_invoice( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._download_billing_subscription_invoice_initial( # type: ignore + raw_result = self._download_billing_subscription_invoice_initial( invoice_name=invoice_name, download_token=download_token, api_version=api_version, @@ -1215,9 +1274,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1229,11 +1288,13 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_billing_subscription_invoice.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download"} # type: ignore + begin_download_billing_subscription_invoice.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download" + } - def _download_multiple_billing_subscription_invoices_initial( + def _download_multiple_billing_subscription_invoices_initial( # pylint: disable=name-too-long self, download_urls: Union[List[str], IO], **kwargs: Any ) -> Optional[_models.DownloadUrl]: error_map = { @@ -1247,9 +1308,9 @@ def _download_multiple_billing_subscription_invoices_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadUrl]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DownloadUrl]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1270,10 +1331,11 @@ def _download_multiple_billing_subscription_invoices_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1297,15 +1359,20 @@ def _download_multiple_billing_subscription_invoices_initial( return deserialized - _download_multiple_billing_subscription_invoices_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments"} # type: ignore + _download_multiple_billing_subscription_invoices_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments" + } @overload - def begin_download_multiple_billing_subscription_invoices( + def begin_download_multiple_billing_subscription_invoices( # pylint: disable=name-too-long self, download_urls: List[str], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param download_urls: An array of download urls for individual documents. Required. :type download_urls: list[str] :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1326,12 +1393,15 @@ def begin_download_multiple_billing_subscription_invoices( """ @overload - def begin_download_multiple_billing_subscription_invoices( + def begin_download_multiple_billing_subscription_invoices( # pylint: disable=name-too-long self, download_urls: IO, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param download_urls: An array of download urls for individual documents. Required. :type download_urls: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1352,14 +1422,17 @@ def begin_download_multiple_billing_subscription_invoices( """ @distributed_trace - def begin_download_multiple_billing_subscription_invoices( + def begin_download_multiple_billing_subscription_invoices( # pylint: disable=name-too-long self, download_urls: Union[List[str], IO], **kwargs: Any ) -> LROPoller[_models.DownloadUrl]: """Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. - :param download_urls: An array of download urls for individual documents. Is either a list type - or a IO type. Required. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + + :param download_urls: An array of download urls for individual documents. Is either a [str] + type or a IO type. Required. :type download_urls: list[str] or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1380,14 +1453,14 @@ def begin_download_multiple_billing_subscription_invoices( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadUrl] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DownloadUrl] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._download_multiple_billing_subscription_invoices_initial( # type: ignore + raw_result = self._download_multiple_billing_subscription_invoices_initial( download_urls=download_urls, api_version=api_version, content_type=content_type, @@ -1405,9 +1478,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1419,6 +1492,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_multiple_billing_subscription_invoices.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments"} # type: ignore + begin_download_multiple_billing_subscription_invoices.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_operations.py index 5100c2c5674a..35b4c3ae9b77 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +39,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,6 +77,9 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists the available billing REST API operations. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :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.billing.models.Operation] @@ -90,8 +88,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,12 +109,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -124,14 +122,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,4 +143,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Billing/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Billing/operations"} diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py index 347fb174297f..62aeb15b5c14 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_policies_operations.py @@ -6,7 +6,6 @@ # 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, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +53,7 @@ def build_get_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,8 +68,8 @@ def build_update_request(billing_account_name: str, billing_profile_name: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +82,7 @@ def build_update_request(billing_account_name: str, billing_profile_name: str, * "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +99,7 @@ def build_get_by_customer_request(billing_account_name: str, customer_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +112,7 @@ def build_get_by_customer_request(billing_account_name: str, customer_name: str, "customerName": _SERIALIZER.url("customer_name", customer_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,8 +127,8 @@ def build_update_customer_request(billing_account_name: str, customer_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +141,7 @@ def build_update_customer_request(billing_account_name: str, customer_name: str, "customerName": _SERIALIZER.url("customer_name", customer_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,6 +180,9 @@ def get_by_billing_profile( """Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -205,8 +203,8 @@ def get_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) request = build_get_by_billing_profile_request( billing_account_name=billing_account_name, @@ -217,10 +215,11 @@ def get_by_billing_profile( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,7 +236,9 @@ def get_by_billing_profile( return deserialized - get_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default"} # type: ignore + get_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default" + } @overload def update( @@ -309,7 +310,7 @@ def update( :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. :type billing_profile_name: str :param parameters: Request parameters that are provided to the update policies operation. Is - either a model type or a IO type. Required. + either a Policy type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.Policy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -330,9 +331,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Policy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Policy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -354,10 +355,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,13 +376,18 @@ def update( return deserialized - update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default"} # type: ignore + update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default" + } @distributed_trace def get_by_customer(self, billing_account_name: str, customer_name: str, **kwargs: Any) -> _models.CustomerPolicy: """Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -401,8 +408,8 @@ def get_by_customer(self, billing_account_name: str, customer_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerPolicy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.CustomerPolicy] = kwargs.pop("cls", None) request = build_get_by_customer_request( billing_account_name=billing_account_name, @@ -413,10 +420,11 @@ def get_by_customer(self, billing_account_name: str, customer_name: str, **kwarg params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,7 +441,9 @@ def get_by_customer(self, billing_account_name: str, customer_name: str, **kwarg return deserialized - get_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default"} # type: ignore + get_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default" + } @overload def update_customer( @@ -509,7 +519,7 @@ def update_customer( :param customer_name: The ID that uniquely identifies a customer. Required. :type customer_name: str :param parameters: Request parameters that are provided to the update policies operation. Is - either a model type or a IO type. Required. + either a CustomerPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.CustomerPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -530,9 +540,9 @@ def update_customer( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerPolicy] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CustomerPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -554,10 +564,11 @@ def update_customer( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,4 +585,6 @@ def update_customer( return deserialized - update_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default"} # type: ignore + update_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py index 545879419300..9e04db8e017c 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_products_operations.py @@ -6,7 +6,6 @@ # 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, IO, Iterable, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +39,7 @@ def build_list_by_customer_request(billing_account_name: str, customer_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,7 @@ def build_list_by_customer_request(billing_account_name: str, customer_name: str "customerName": _SERIALIZER.url("customer_name", customer_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +69,7 @@ def build_list_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +78,7 @@ def build_list_by_billing_account_request( "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +97,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +110,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +134,7 @@ def build_list_by_invoice_section_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +148,7 @@ def build_list_by_invoice_section_request( "invoiceSectionName": _SERIALIZER.url("invoice_section_name", invoice_section_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,7 +165,7 @@ def build_get_request(billing_account_name: str, product_name: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +177,7 @@ def build_get_request(billing_account_name: str, product_name: str, **kwargs: An "productName": _SERIALIZER.url("product_name", product_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,8 +192,8 @@ def build_update_request(billing_account_name: str, product_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +205,7 @@ def build_update_request(billing_account_name: str, product_name: str, **kwargs: "productName": _SERIALIZER.url("product_name", product_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -227,8 +222,8 @@ def build_move_request(billing_account_name: str, product_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,7 +235,7 @@ def build_move_request(billing_account_name: str, product_name: str, **kwargs: A "productName": _SERIALIZER.url("product_name", product_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -257,8 +252,8 @@ def build_validate_move_request(billing_account_name: str, product_name: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -271,7 +266,7 @@ def build_validate_move_request(billing_account_name: str, product_name: str, ** "productName": _SERIALIZER.url("product_name", product_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -311,6 +306,9 @@ def list_by_customer( operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param customer_name: The ID that uniquely identifies a customer. Required. @@ -323,8 +321,8 @@ def list_by_customer( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -346,12 +344,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -359,14 +357,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,7 +378,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_customer.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products"} # type: ignore + list_by_customer.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products" + } @distributed_trace def list_by_billing_account( @@ -389,6 +390,9 @@ def list_by_billing_account( The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param filter: May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', @@ -403,8 +407,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -426,12 +430,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -439,14 +443,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -459,7 +464,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products" + } @distributed_trace def list_by_billing_profile( @@ -469,6 +476,9 @@ def list_by_billing_profile( The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -485,8 +495,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -509,12 +519,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -522,14 +532,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,7 +553,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products" + } @distributed_trace def list_by_invoice_section( @@ -557,6 +570,9 @@ def list_by_invoice_section( The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param billing_profile_name: The ID that uniquely identifies a billing profile. Required. @@ -575,8 +591,8 @@ def list_by_invoice_section( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProductsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ProductsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -600,12 +616,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -613,14 +629,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProductsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,13 +650,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_invoice_section.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products"} # type: ignore + list_by_invoice_section.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products" + } @distributed_trace def get(self, billing_account_name: str, product_name: str, **kwargs: Any) -> _models.Product: """Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -660,8 +682,8 @@ def get(self, billing_account_name: str, product_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Product] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) request = build_get_request( billing_account_name=billing_account_name, @@ -672,10 +694,11 @@ def get(self, billing_account_name: str, product_name: str, **kwargs: Any) -> _m params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -692,7 +715,7 @@ def get(self, billing_account_name: str, product_name: str, **kwargs: Any) -> _m return deserialized - get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}"} @overload def update( @@ -764,7 +787,7 @@ def update( :param product_name: The ID that uniquely identifies a product. Required. :type product_name: str :param parameters: Request parameters that are provided to the update product operation. Is - either a model type or a IO type. Required. + either a Product type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.Product or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -785,9 +808,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Product] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Product] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -809,10 +832,11 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -829,7 +853,9 @@ def update( return deserialized - update.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}"} # type: ignore + update.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}" + } @overload def move( @@ -846,6 +872,9 @@ def move( products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -877,6 +906,9 @@ def move( products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -906,12 +938,15 @@ def move( products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. :type product_name: str :param parameters: Request parameters that are provided to the move product operation. Is - either a model type or a IO type. Required. + either a TransferProductRequestProperties type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.TransferProductRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -932,9 +967,9 @@ def move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.Product]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Product]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -956,10 +991,11 @@ def move( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -983,7 +1019,9 @@ def move( return deserialized - move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move"} # type: ignore + move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move" + } @overload def validate_move( @@ -999,6 +1037,9 @@ def validate_move( supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -1029,6 +1070,9 @@ def validate_move( supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. @@ -1057,12 +1101,15 @@ def validate_move( supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param product_name: The ID that uniquely identifies a product. Required. :type product_name: str :param parameters: Request parameters that are provided to the validate move eligibility - operation. Is either a model type or a IO type. Required. + operation. Is either a TransferProductRequestProperties type or a IO type. Required. :type parameters: ~azure.mgmt.billing.models.TransferProductRequestProperties or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1083,9 +1130,9 @@ def validate_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateProductTransferEligibilityResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateProductTransferEligibilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1107,10 +1154,11 @@ def validate_move( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1127,4 +1175,6 @@ def validate_move( return deserialized - validate_move.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility"} # type: ignore + validate_move.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_reservations_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_reservations_operations.py index fa2d8e5391a7..a1305365a3e1 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_reservations_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_reservations_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +47,7 @@ def build_list_by_billing_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_billing_account_request( "billingAccountName": _SERIALIZER.url("billing_account_name", billing_account_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +88,7 @@ def build_list_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +101,7 @@ def build_list_by_billing_profile_request( "billingProfileName": _SERIALIZER.url("billing_profile_name", billing_profile_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -178,8 +173,8 @@ def list_by_billing_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReservationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ReservationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -204,12 +199,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -217,14 +212,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReservationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,7 +233,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservations"} # type: ignore + list_by_billing_account.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservations" + } @distributed_trace def list_by_billing_profile( @@ -276,8 +274,8 @@ def list_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ReservationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.ReservationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -303,12 +301,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -316,14 +314,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ReservationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -336,4 +335,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/reservations"} # type: ignore + list_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/reservations" + } diff --git a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py index fc3fe547b094..b4654bc6d5f5 100644 --- a/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py +++ b/sdk/billing/azure-mgmt-billing/azure/mgmt/billing/operations/_transactions_operations.py @@ -6,7 +6,6 @@ # 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 from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +39,7 @@ def build_list_by_invoice_request(billing_account_name: str, invoice_name: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,7 @@ def build_list_by_invoice_request(billing_account_name: str, invoice_name: str, "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,6 +89,9 @@ def list_by_invoice( """Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/billing/ + :param billing_account_name: The ID that uniquely identifies a billing account. Required. :type billing_account_name: str :param invoice_name: The ID that uniquely identifies an invoice. Required. @@ -106,8 +104,8 @@ def list_by_invoice( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) # type: Literal["2020-05-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TransactionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-05-01")) + cls: ClsType[_models.TransactionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,12 +127,12 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: request = HttpRequest("GET", next_link) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -142,14 +140,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TransactionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,4 +161,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_invoice.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions"} # type: ignore + list_by_invoice.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions" + } diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/billing_accounts.py b/sdk/billing/azure-mgmt-billing/generated_samples/billing_account.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/billing_accounts.py rename to sdk/billing/azure-mgmt-billing/generated_samples/billing_account.py index f3c137d369b2..8588395e8226 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/billing_accounts.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/billing_account.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python billing_accounts.py + python billing_account.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/billing_profile_permissions_list.py b/sdk/billing/azure-mgmt-billing/generated_samples/billing_profile_permissions_list.py index 0b4a45fdfdf9..a89414abd7e9 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/billing_profile_permissions_list.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/billing_profile_permissions_list.py @@ -29,14 +29,14 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.billing_permissions.list_by_customer( + response = client.billing_permissions.list_by_billing_profile( billing_account_name="{billingAccountName}", - customer_name="{customerName}", + billing_profile_name="{billingProfileName}", ) for item in response: print(item) -# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomerPermissionsList.json +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfilePermissionsList.json if __name__ == "__main__": main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/billing_subscription_invoice.py b/sdk/billing/azure-mgmt-billing/generated_samples/billing_subscription_invoice.py new file mode 100644 index 000000000000..bf00795d642e --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/billing_subscription_invoice.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python billing_subscription_invoice.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.invoices.get_by_subscription_and_invoice_id( + invoice_name="{invoiceName}", + ) + print(response) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionInvoice.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/billing_subscription_invoices_list.py b/sdk/billing/azure-mgmt-billing/generated_samples/billing_subscription_invoices_list.py new file mode 100644 index 000000000000..9839483f2393 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/billing_subscription_invoices_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python billing_subscription_invoices_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.invoices.list_by_billing_subscription( + period_start_date="2022-01-01", + period_end_date="2022-06-30", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionInvoicesList.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/customer_permissions_list.py b/sdk/billing/azure-mgmt-billing/generated_samples/customer_permissions_list.py new file mode 100644 index 000000000000..ff0d9f917ec5 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/customer_permissions_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python customer_permissions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.billing_permissions.list_by_customer( + billing_account_name="{billingAccountName}", + customer_name="{customerName}", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomerPermissionsList.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/policy_by_customer.py b/sdk/billing/azure-mgmt-billing/generated_samples/customer_policy.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/policy_by_customer.py rename to sdk/billing/azure-mgmt-billing/generated_samples/customer_policy.py index f970c82d5b10..c7e13ff8f63e 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/policy_by_customer.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/customer_policy.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python policy_by_customer.py + python customer_policy.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/get_operations.py b/sdk/billing/azure-mgmt-billing/generated_samples/get_operations.py new file mode 100644 index 000000000000..ee378272a185 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/get_operations.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python get_operations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/GetOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/invoice_by_id.py b/sdk/billing/azure-mgmt-billing/generated_samples/invoice_by_id.py new file mode 100644 index 000000000000..db431ea788a6 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/invoice_by_id.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python invoice_by_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.invoices.get_by_id( + invoice_name="{invoiceName}", + ) + print(response) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceById.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/invoice_download.py b/sdk/billing/azure-mgmt-billing/generated_samples/modern_invoice_download.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/invoice_download.py rename to sdk/billing/azure-mgmt-billing/generated_samples/modern_invoice_download.py index a53e9423f5e3..7de13c031772 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/invoice_download.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/modern_invoice_download.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python invoice_download.py + python modern_invoice_download.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/multiple_billing_subscription_invoice_download.py b/sdk/billing/azure-mgmt-billing/generated_samples/multiple_billing_subscription_invoice_download.py new file mode 100644 index 000000000000..e00009b4fa8b --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/multiple_billing_subscription_invoice_download.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python multiple_billing_subscription_invoice_download.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.invoices.begin_download_multiple_billing_subscription_invoices( + download_urls=[ + "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01", + "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01", + "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01", + ], + ).result() + print(response) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/MultipleBillingSubscriptionInvoiceDownload.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/billing_profile_invoice_download.py b/sdk/billing/azure-mgmt-billing/generated_samples/multiple_modern_invoice_download.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/billing_profile_invoice_download.py rename to sdk/billing/azure-mgmt-billing/generated_samples/multiple_modern_invoice_download.py index c5355383564b..c01d80502ff2 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/billing_profile_invoice_download.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/multiple_modern_invoice_download.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python billing_profile_invoice_download.py + python multiple_modern_invoice_download.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/policy_by_billing_profile.py b/sdk/billing/azure-mgmt-billing/generated_samples/policy.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/policy_by_billing_profile.py rename to sdk/billing/azure-mgmt-billing/generated_samples/policy.py index c5578a25dd2d..97254ad66956 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/policy_by_billing_profile.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/policy.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python policy_by_billing_profile.py + python policy.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/products_list_by_customer.py b/sdk/billing/azure-mgmt-billing/generated_samples/products_list_by_customer.py new file mode 100644 index 000000000000..2fb767854361 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/products_list_by_customer.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python products_list_by_customer.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.products.list_by_customer( + billing_account_name="{billingAccountName}", + customer_name="{customerName}", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ProductsListByCustomer.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/products_list_by_invoice_section.py b/sdk/billing/azure-mgmt-billing/generated_samples/products_list_by_invoice_section.py index 2617237dc9b6..8397f0c1ae88 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/products_list_by_invoice_section.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/products_list_by_invoice_section.py @@ -29,14 +29,15 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.products.list_by_customer( + response = client.products.list_by_invoice_section( billing_account_name="{billingAccountName}", - customer_name="{customerName}", + billing_profile_name="{billingProfileName}", + invoice_section_name="{invoiceSectionName}", ) for item in response: print(item) -# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ProductsListByCustomer.json +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ProductsListByInvoiceSection.json if __name__ == "__main__": main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/create_billing_profile.py b/sdk/billing/azure-mgmt-billing/generated_samples/put_billing_profile.py similarity index 98% rename from sdk/billing/azure-mgmt-billing/generated_samples/create_billing_profile.py rename to sdk/billing/azure-mgmt-billing/generated_samples/put_billing_profile.py index 151856c1dee6..83075e45cbc4 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/create_billing_profile.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/put_billing_profile.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python create_billing_profile.py + python put_billing_profile.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/update_billing_property.py b/sdk/billing/azure-mgmt-billing/generated_samples/update_billing_property.py index 0e4872aae62e..10f9b64c8e35 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/update_billing_property.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/update_billing_property.py @@ -29,13 +29,12 @@ def main(): subscription_id="{subscriptionId}", ) - response = client.billing_subscriptions.update( - billing_account_name="{billingAccountName}", - parameters={"properties": {"costCenter": "ABC1234"}}, + response = client.billing_property.update( + parameters={"properties": {"costCenter": "1010"}}, ) print(response) -# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateBillingSubscription.json +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateBillingProperty.json if __name__ == "__main__": main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/update_billing_subscription.py b/sdk/billing/azure-mgmt-billing/generated_samples/update_billing_subscription.py new file mode 100644 index 000000000000..0d3a9b053509 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/update_billing_subscription.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python update_billing_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.billing_subscriptions.update( + billing_account_name="{billingAccountName}", + parameters={"properties": {"costCenter": "ABC1234"}}, + ) + print(response) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateBillingSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/update_customer.py b/sdk/billing/azure-mgmt-billing/generated_samples/update_customer_policy.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/update_customer.py rename to sdk/billing/azure-mgmt-billing/generated_samples/update_customer_policy.py index 8460327ca9cb..8d129d2d3234 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/update_customer.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/update_customer_policy.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python update_customer.py + python update_customer_policy.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/update_product.py b/sdk/billing/azure-mgmt-billing/generated_samples/update_product.py new file mode 100644 index 000000000000..d87e10839cb4 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/update_product.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python update_product.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.products.update( + billing_account_name="{billingAccountName}", + product_name="{productName}", + parameters={"properties": {"autoRenew": "Off"}}, + ) + print(response) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateProduct.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/validate_product_move_failure.py b/sdk/billing/azure-mgmt-billing/generated_samples/validate_product_move_failure.py new file mode 100644 index 000000000000..3e8f4aef5063 --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/validate_product_move_failure.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python validate_product_move_failure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.products.validate_move( + billing_account_name="{billingAccountName}", + product_name="{productName}", + parameters={ + "destinationInvoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" + }, + ) + print(response) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveFailure.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/validate_product_move_success.py b/sdk/billing/azure-mgmt-billing/generated_samples/validate_product_move_success.py new file mode 100644 index 000000000000..22037dd80f1d --- /dev/null +++ b/sdk/billing/azure-mgmt-billing/generated_samples/validate_product_move_success.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.billing import BillingManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-billing +# USAGE + python validate_product_move_success.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BillingManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.products.validate_move( + billing_account_name="{billingAccountName}", + product_name="{productName}", + parameters={ + "destinationInvoiceSectionId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}" + }, + ) + print(response) + + +# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveSuccess.json +if __name__ == "__main__": + main() diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/subscription_move_validate_failure.py b/sdk/billing/azure-mgmt-billing/generated_samples/validate_subscription_move_failure.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/subscription_move_validate_failure.py rename to sdk/billing/azure-mgmt-billing/generated_samples/validate_subscription_move_failure.py index b9fcf4881a6b..53883bcf4f4e 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/subscription_move_validate_failure.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/validate_subscription_move_failure.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python subscription_move_validate_failure.py + python validate_subscription_move_failure.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/billing/azure-mgmt-billing/generated_samples/subscription_move_validate_success.py b/sdk/billing/azure-mgmt-billing/generated_samples/validate_subscription_move_success.py similarity index 97% rename from sdk/billing/azure-mgmt-billing/generated_samples/subscription_move_validate_success.py rename to sdk/billing/azure-mgmt-billing/generated_samples/validate_subscription_move_success.py index 85f0dfba3240..def4091732e1 100644 --- a/sdk/billing/azure-mgmt-billing/generated_samples/subscription_move_validate_success.py +++ b/sdk/billing/azure-mgmt-billing/generated_samples/validate_subscription_move_success.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-billing # USAGE - python subscription_move_validate_success.py + python validate_subscription_move_success.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,