diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json index f20a7c259f2b..6a5c1f12f286 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json +++ b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e77f2f011a17a05457e14a0e78b10c100337a557", + "commit": "e4d7f2611c6af05d25eab40a26926613de7d7baf", "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/cost-management/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/cost-management/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/cost-management/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__init__.py index 8968aa76c748..327688c9882a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py index dabc5c4d4905..8087ca9f9c1f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -40,7 +34,7 @@ class CostManagementClientConfiguration(Configuration): # pylint: disable=too-m def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(CostManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-10-01") # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", "2022-10-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +45,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-costmanagement/{}".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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py index 4ba98e38ed43..0e26e2fa3291 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_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 CostManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -100,9 +100,9 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = CostManagementClientConfiguration(credential=credential, **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 @@ -161,15 +161,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: () -> CostManagementClient + def __enter__(self) -> "CostManagementClient": 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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_serialization.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_serialization.py index 7c1dedb5133d..842ae727fbbc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_serialization.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_vendor.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_vendor.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py index 3073d7c910a0..e5754a47ce68 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/__init__.py index b7a880c83975..e631aab7dc99 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py index 585b86de08bd..55e6f4190aa5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -40,7 +34,7 @@ class CostManagementClientConfiguration(Configuration): # pylint: disable=too-m def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(CostManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-10-01") # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", "2022-10-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py index 0b26c3c423d1..daa9e01ede33 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_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 CostManagementClientConfiguration from .operations import ( @@ -100,9 +100,9 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = CostManagementClientConfiguration(credential=credential, **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 @@ -168,5 +168,5 @@ async def __aenter__(self) -> "CostManagementClient": 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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py index 2d305a7dc351..ba3f6355c103 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py @@ -28,7 +28,7 @@ from ._benefit_utilization_summaries_operations import BenefitUtilizationSummariesOperations 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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py index c24ac2826010..ce725afb7c31 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_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_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]] @@ -64,6 +59,9 @@ def __init__(self, *args, **kwargs) -> None: async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: """Lists the alerts for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -97,10 +95,8 @@ async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -110,10 +106,11 @@ async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: 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 @@ -130,12 +127,15 @@ async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} @distributed_trace_async async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: """Gets the alert for the scope by alert ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -171,10 +171,8 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -185,10 +183,11 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: 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,7 +204,7 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @overload async def dismiss( @@ -219,6 +218,9 @@ async def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -255,6 +257,9 @@ async def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -291,6 +296,9 @@ async def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -310,8 +318,8 @@ async def dismiss( :type scope: str :param alert_id: Alert ID. Required. :type alert_id: str - :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a + DismissAlertPayload type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.DismissAlertPayload or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -332,11 +340,9 @@ async def dismiss( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -358,10 +364,11 @@ async def dismiss( 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 @@ -378,7 +385,7 @@ async def dismiss( return deserialized - dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @distributed_trace_async async def list_external( @@ -389,6 +396,9 @@ async def list_external( ) -> _models.AlertsResult: """Lists the Alerts for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -415,10 +425,8 @@ async def list_external( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_external_request( external_cloud_provider_type=external_cloud_provider_type, @@ -429,10 +437,11 @@ async def list_external( 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 @@ -449,4 +458,6 @@ async def list_external( return deserialized - list_external.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts"} # type: ignore + list_external.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_operations.py index 95dfa1cd9532..cafa32b3d00d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_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 import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._benefit_recommendations_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]] @@ -68,6 +63,9 @@ def list( ) -> AsyncIterable["_models.BenefitRecommendationModel"]: """List of recommendations for purchasing savings plan. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/CostManagement/ + :param billing_scope: The scope associated with benefit recommendation operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, @@ -99,10 +97,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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitRecommendationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitRecommendationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,7 +122,7 @@ 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: # make call to next link with the client's api-version @@ -142,7 +138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -150,14 +146,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitRecommendationsListResult", 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 @@ -170,4 +167,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} # type: ignore + list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_operations.py index e38164f1b6da..81caf0cefc6f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_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, Union import urllib.parse @@ -35,10 +34,6 @@ build_list_by_savings_plan_order_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_account_id( """Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param grain_parameter: Grain. Known values are: "Hourly", "Daily", and "Monthly". Default @@ -91,10 +89,8 @@ def list_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,7 +113,7 @@ 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: # make call to next link with the client's api-version @@ -133,7 +129,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -141,14 +137,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -161,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_billing_profile_id( @@ -175,6 +174,9 @@ def list_by_billing_profile_id( """Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param billing_profile_id: Billing profile ID. Required. @@ -195,10 +197,8 @@ def list_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -222,7 +222,7 @@ 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: # make call to next link with the client's api-version @@ -238,7 +238,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -246,14 +246,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -266,7 +267,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_order( @@ -278,6 +281,9 @@ def list_by_savings_plan_order( ) -> AsyncIterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param filter: Supports filtering by properties/usageDate. Default value is None. @@ -295,10 +301,8 @@ def list_by_savings_plan_order( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -321,7 +325,7 @@ 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: # make call to next link with the client's api-version @@ -337,7 +341,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -345,14 +349,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -365,7 +370,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_savings_plan_order.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_order.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_id( @@ -378,6 +385,9 @@ def list_by_savings_plan_id( ) -> AsyncIterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param savings_plan_id: Savings plan ID. Required. @@ -397,10 +407,8 @@ def list_by_savings_plan_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -424,7 +432,7 @@ 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: # make call to next link with the client's api-version @@ -440,7 +448,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -448,14 +456,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -468,4 +477,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_savings_plan_id.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_id.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py index eff1333cb7cd..1f64b263a6b0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_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, Union import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._dimensions_operations import build_by_external_cloud_provider_type_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]] @@ -69,6 +64,9 @@ def list( ) -> AsyncIterable["_models.Dimension"]: """Lists the dimensions by the defined scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -109,10 +107,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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -137,7 +133,7 @@ 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: # make call to next link with the client's api-version @@ -153,7 +149,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -161,14 +157,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", 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 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 @@ -181,7 +178,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} @distributed_trace def by_external_cloud_provider_type( @@ -196,6 +193,9 @@ def by_external_cloud_provider_type( ) -> AsyncIterable["_models.Dimension"]: """Lists the dimensions by the external cloud provider type. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -229,10 +229,8 @@ def by_external_cloud_provider_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -258,7 +256,7 @@ 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: # make call to next link with the client's api-version @@ -274,7 +272,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -282,14 +280,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", 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 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 @@ -302,4 +301,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions"} # type: ignore + by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py index d8ef0ca18c5b..1c4ec0dc9014 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_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 ( @@ -35,10 +34,6 @@ 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]] @@ -66,6 +61,9 @@ def __init__(self, *args, **kwargs) -> None: async def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _models.ExportListResult: """The operation to list all exports at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -103,10 +101,8 @@ async def list(self, scope: str, expand: Optional[str] = None, **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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportListResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -117,10 +113,11 @@ async def list(self, scope: str, expand: Optional[str] = None, **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 @@ -137,12 +134,15 @@ async def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} @distributed_trace_async async def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwargs: Any) -> _models.Export: """The operation to get the export for the defined scope by export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -182,10 +182,8 @@ async def get(self, scope: str, export_name: str, expand: Optional[str] = None, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -197,10 +195,11 @@ async def get(self, scope: str, export_name: str, expand: Optional[str] = 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) - 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 +216,7 @@ async def get(self, scope: str, export_name: str, expand: Optional[str] = None, return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @overload async def create_or_update( @@ -233,6 +232,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -271,6 +273,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -309,6 +314,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -329,7 +337,7 @@ async def create_or_update( :param export_name: Export Name. Required. :type export_name: str :param parameters: Parameters supplied to the CreateOrUpdate Export operation. Is either a - model type or a IO type. Required. + Export type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.Export or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -350,11 +358,9 @@ async def 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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -376,10 +382,11 @@ async def create_or_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 @@ -396,11 +403,11 @@ async def create_or_update( deserialized = self._deserialize("Export", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -408,6 +415,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -443,10 +453,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -457,10 +465,11 @@ async def delete( # pylint: disable=inconsistent-return-statements 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 @@ -473,7 +482,7 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace_async async def execute( # pylint: disable=inconsistent-return-statements @@ -481,6 +490,9 @@ async def execute( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to run an export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -516,10 +528,8 @@ async def execute( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( scope=scope, @@ -530,10 +540,11 @@ async def execute( # pylint: disable=inconsistent-return-statements 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 @@ -546,7 +557,7 @@ async def execute( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} # type: ignore + execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} @distributed_trace_async async def get_execution_history( @@ -554,6 +565,9 @@ async def get_execution_history( ) -> _models.ExportExecutionListResult: """The operation to get the run history of an export for the defined scope and export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -589,10 +603,8 @@ async def get_execution_history( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportExecutionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportExecutionListResult] = kwargs.pop("cls", None) request = build_get_execution_history_request( scope=scope, @@ -603,10 +615,11 @@ async def get_execution_history( 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 @@ -623,4 +636,6 @@ async def get_execution_history( return deserialized - get_execution_history.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory"} # type: ignore + get_execution_history.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py index a84cbc9bac29..22f372060e7e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_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._forecast_operations import build_external_cloud_provider_usage_request, build_usage_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 usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -112,6 +110,9 @@ async def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -151,6 +152,9 @@ async def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -169,7 +173,7 @@ async def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -194,11 +198,9 @@ async def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ForecastResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ForecastResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -220,10 +222,11 @@ async def usage( 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 @@ -242,7 +245,7 @@ async def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} @overload async def external_cloud_provider_usage( @@ -257,6 +260,9 @@ async def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -296,6 +302,9 @@ async def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -333,6 +342,9 @@ async def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -344,7 +356,7 @@ async def external_cloud_provider_usage( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -369,11 +381,9 @@ async def external_cloud_provider_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ForecastResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ForecastResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -396,10 +406,11 @@ async def external_cloud_provider_usage( 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 @@ -416,4 +427,6 @@ async def external_cloud_provider_usage( return deserialized - external_cloud_provider_usage.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast"} # type: ignore + external_cloud_provider_usage.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_operations.py index b494d94e6028..28b1019e121b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_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, cast, overload from azure.core.exceptions import ( @@ -33,10 +32,6 @@ build_get_operation_results_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,11 +69,9 @@ async def _create_operation_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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -99,15 +92,16 @@ async def _create_operation_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 - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.GenerateCostDetailsReportErrorResponse, pipeline_response @@ -128,7 +122,9 @@ async def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport" + } @overload async def begin_create_operation( @@ -148,7 +144,12 @@ async def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -186,7 +187,12 @@ async def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -224,13 +230,18 @@ async def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str - :param parameters: Parameters supplied to the Create cost details operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to the Create cost details operation. Is either a + GenerateCostDetailsReportRequestDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateCostDetailsReportRequestDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -253,16 +264,14 @@ async def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CostDetailsOperationResults] = 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_operation_initial( # type: ignore + raw_result = await self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -281,9 +290,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: @@ -295,9 +304,9 @@ 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_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} async def _get_operation_results_initial( self, scope: str, operation_id: str, **kwargs: Any @@ -313,10 +322,8 @@ async def _get_operation_results_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) request = build_get_operation_results_request( scope=scope, @@ -327,10 +334,11 @@ async def _get_operation_results_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 @@ -349,7 +357,9 @@ async def _get_operation_results_initial( return deserialized - _get_operation_results_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + _get_operation_results_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } @distributed_trace_async async def begin_get_operation_results( @@ -380,15 +390,13 @@ async def begin_get_operation_results( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CostDetailsOperationResults] = 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._get_operation_results_initial( # type: ignore + raw_result = await self._get_operation_results_initial( scope=scope, operation_id=operation_id, api_version=api_version, @@ -406,9 +414,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: @@ -420,6 +428,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_get_operation_results.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + begin_get_operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py index 9337dc341ee7..f1fa361658d2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_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, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._generate_detailed_cost_report_operation_results_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]] @@ -71,10 +66,8 @@ async def _get_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -85,10 +78,11 @@ async def _get_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 @@ -107,7 +101,7 @@ async def _get_initial( return deserialized - _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} @distributed_trace_async async def begin_get( @@ -138,15 +132,13 @@ async def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = 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._get_initial( # type: ignore + raw_result = await self._get_initial( operation_id=operation_id, scope=scope, api_version=api_version, @@ -164,7 +156,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: @@ -176,6 +168,6 @@ 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_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + begin_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py index 3bf99479ad16..241b5a5598cf 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_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._generate_detailed_cost_report_operation_status_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]] @@ -83,10 +78,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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationStatuses] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationStatuses] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -97,10 +90,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 @@ -117,4 +111,4 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py index 1ea51c38d877..cc52ae3dbe9c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_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, cast, overload from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._generate_detailed_cost_report_operations import build_create_operation_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,11 +66,9 @@ async def _create_operation_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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -96,10 +89,11 @@ async def _create_operation_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 @@ -131,7 +125,9 @@ async def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport" + } @overload async def begin_create_operation( @@ -148,6 +144,9 @@ async def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -181,6 +180,9 @@ async def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -214,11 +216,14 @@ async def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str :param parameters: Parameters supplied to the Create detailed cost report operation. Is either - a model type or a IO type. Required. + a GenerateDetailedCostReportDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -240,16 +245,14 @@ async def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = 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_operation_initial( # type: ignore + raw_result = await self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -268,9 +271,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: @@ -282,6 +285,6 @@ 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_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py index 20874b3d0edf..f9da4d617b6a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_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, Union, cast from azure.core.exceptions import ( @@ -33,10 +32,6 @@ build_by_billing_profile_id_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,10 +69,8 @@ async def _by_billing_account_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_account_id_request( billing_account_id=billing_account_id, @@ -89,10 +82,11 @@ async def _by_billing_account_id_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 @@ -116,7 +110,9 @@ async def _by_billing_account_id_initial( return deserialized - _by_billing_account_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_account_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace_async async def begin_by_billing_account_id( @@ -125,7 +121,10 @@ async def begin_by_billing_account_id( """Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, - https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + https://docs.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). Required. :type billing_account_id: str @@ -149,15 +148,13 @@ async def begin_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = 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._by_billing_account_id_initial( # type: ignore + raw_result = await self._by_billing_account_id_initial( billing_account_id=billing_account_id, start_date=start_date, end_date=end_date, @@ -176,9 +173,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: @@ -190,9 +187,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_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } async def _by_billing_profile_id_initial( self, billing_account_id: str, billing_profile_id: str, start_date: str, end_date: str, **kwargs: Any @@ -208,10 +207,8 @@ async def _by_billing_profile_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_profile_id_request( billing_account_id=billing_account_id, @@ -224,10 +221,11 @@ async def _by_billing_profile_id_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 @@ -251,7 +249,9 @@ async def _by_billing_profile_id_initial( return deserialized - _by_billing_profile_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_profile_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace_async async def begin_by_billing_profile_id( @@ -260,7 +260,10 @@ async def begin_by_billing_profile_id( """Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, - https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + https://docs.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param billing_account_id: Billing account ID. Required. :type billing_account_id: str @@ -286,15 +289,13 @@ async def begin_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = 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._by_billing_profile_id_initial( # type: ignore + raw_result = await self._by_billing_profile_id_initial( billing_account_id=billing_account_id, billing_profile_id=billing_profile_id, start_date=start_date, @@ -314,9 +315,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: @@ -328,6 +329,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_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py index 6134de06e246..9ea97535fb12 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/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 import urllib.parse @@ -30,10 +29,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]] @@ -71,10 +66,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.CostManagementOperation" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +87,7 @@ 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: # make call to next link with the client's api-version @@ -110,7 +103,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 +111,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 @@ -138,4 +132,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_operations.py index a9689d030d9a..ee61643df312 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_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, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._price_sheet_operations import build_download_by_billing_profile_request, build_download_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 @@ async def _download_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_request( billing_account_name=billing_account_name, @@ -86,10 +79,11 @@ async def _download_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 @@ -114,7 +108,9 @@ async def _download_initial( return deserialized - _download_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace_async async def begin_download( @@ -145,15 +141,13 @@ async def begin_download( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-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", self._config.api_version)) + 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_initial( # type: ignore + raw_result = await self._download_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, invoice_name=invoice_name, @@ -172,9 +166,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: @@ -186,9 +180,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.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } async def _download_by_billing_profile_initial( self, billing_account_name: str, billing_profile_name: str, **kwargs: Any @@ -204,10 +200,8 @@ async def _download_by_billing_profile_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_by_billing_profile_request( billing_account_name=billing_account_name, @@ -218,10 +212,11 @@ async def _download_by_billing_profile_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 @@ -246,7 +241,9 @@ async def _download_by_billing_profile_initial( return deserialized - _download_by_billing_profile_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_by_billing_profile_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace_async async def begin_download_by_billing_profile( @@ -278,15 +275,13 @@ async def begin_download_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", self._config.api_version) - ) # type: Literal["2022-10-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", self._config.api_version)) + 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_by_billing_profile_initial( # type: ignore + raw_result = await self._download_by_billing_profile_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, api_version=api_version, @@ -304,9 +299,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: @@ -318,6 +313,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_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py index da801dee2c07..271b0475eee6 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_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._query_operations import build_usage_by_external_cloud_provider_type_request, build_usage_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]] @@ -61,6 +56,9 @@ async def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -95,6 +93,9 @@ async def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -129,6 +130,9 @@ async def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -147,7 +151,7 @@ async def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -168,11 +172,9 @@ async def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.QueryResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.QueryResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -193,10 +195,11 @@ async def usage( 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 @@ -215,7 +218,7 @@ async def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} @overload async def usage_by_external_cloud_provider_type( @@ -229,6 +232,9 @@ async def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -262,6 +268,9 @@ async def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -293,6 +302,9 @@ async def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -304,7 +316,7 @@ async def usage_by_external_cloud_provider_type( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -325,11 +337,9 @@ async def usage_by_external_cloud_provider_type( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueryResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -351,10 +361,11 @@ async def usage_by_external_cloud_provider_type( 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 @@ -371,4 +382,6 @@ async def usage_by_external_cloud_provider_type( return deserialized - usage_by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query"} # type: ignore + usage_by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_operations.py index f46cbd55ddb5..e2eae0d9249e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_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 import urllib.parse @@ -44,10 +43,6 @@ build_run_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 __init__(self, *args, **kwargs) -> None: def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ScheduledAction"]: """List all private scheduled actions. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param filter: May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. Default value is None. :type filter: str @@ -87,10 +85,8 @@ def list(self, filter: 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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +107,7 @@ 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: # make call to next link with the client's api-version @@ -127,7 +123,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -135,27 +131,30 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} @distributed_trace def list_by_scope( @@ -163,6 +162,9 @@ def list_by_scope( ) -> AsyncIterable["_models.ScheduledAction"]: """List all shared scheduled actions within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -193,10 +195,8 @@ def list_by_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -218,7 +218,7 @@ 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: # make call to next link with the client's api-version @@ -234,7 +234,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -242,33 +242,37 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} @overload async def create_or_update( self, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -279,6 +283,10 @@ async def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -290,7 +298,13 @@ async def create_or_update( @overload async def create_or_update( - self, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. @@ -298,6 +312,10 @@ async def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -309,15 +327,23 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -337,11 +363,9 @@ async def 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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -353,6 +377,7 @@ async def create_or_update( request = build_create_or_update_request( name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -362,17 +387,18 @@ async def create_or_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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -382,16 +408,19 @@ async def create_or_update( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the private scheduled action by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -410,10 +439,8 @@ async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_request( name=name, @@ -423,17 +450,18 @@ async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -443,12 +471,15 @@ async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Delete a private scheduled action. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -467,10 +498,8 @@ async def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( name=name, @@ -480,23 +509,24 @@ async def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inc 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 if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @overload async def create_or_update_by_scope( @@ -504,6 +534,7 @@ async def create_or_update_by_scope( scope: str, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -532,6 +563,10 @@ async def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -543,7 +578,14 @@ async def create_or_update_by_scope( @overload async def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -569,6 +611,10 @@ async def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -580,7 +626,12 @@ async def create_or_update_by_scope( @distributed_trace_async async def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -604,9 +655,13 @@ async def create_or_update_by_scope( :type scope: str :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -626,11 +681,9 @@ async def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -643,6 +696,7 @@ async def create_or_update_by_scope( request = build_create_or_update_by_scope_request( scope=scope, name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -652,17 +706,18 @@ async def create_or_update_by_scope( 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -672,16 +727,19 @@ async def create_or_update_by_scope( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the shared scheduled action from the given scope by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -718,10 +776,8 @@ async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Sc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -732,17 +788,18 @@ async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Sc 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -752,7 +809,7 @@ async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Sc return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -760,6 +817,9 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a scheduled action within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -796,10 +856,8 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -810,23 +868,24 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements 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 if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -850,10 +909,8 @@ async def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_request( name=name, @@ -863,23 +920,24 @@ async def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=incons 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @distributed_trace_async async def run_by_scope( # pylint: disable=inconsistent-return-statements @@ -923,10 +981,8 @@ async def run_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_by_scope_request( scope=scope, @@ -937,23 +993,24 @@ async def run_by_scope( # pylint: disable=inconsistent-return-statements 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @overload async def check_name_availability( @@ -1001,7 +1058,7 @@ async def check_name_availability( """Checks availability and correctness of the name for a scheduled action. :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1023,11 +1080,9 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1047,17 +1102,18 @@ async def check_name_availability( 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1067,7 +1123,7 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} @overload async def check_name_availability_by_scope( @@ -1173,7 +1229,7 @@ async def check_name_availability_by_scope( Required. :type scope: str :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1195,11 +1251,9 @@ async def check_name_availability_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1220,17 +1274,18 @@ async def check_name_availability_by_scope( 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1240,4 +1295,6 @@ async def check_name_availability_by_scope( return deserialized - check_name_availability_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability_by_scope.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py index 783b77477239..bb0b3e8bccd4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_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 import urllib.parse @@ -40,10 +39,6 @@ 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,6 +66,9 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.View"]: """Lists all views by tenant and object. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either View or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.View] @@ -79,10 +77,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.View"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +98,7 @@ 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: # make call to next link with the client's api-version @@ -118,7 +114,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -126,14 +122,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", 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 @@ -146,12 +143,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} @distributed_trace def list_by_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.View"]: """Lists all views at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -178,10 +178,8 @@ def list_by_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Vie _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -202,7 +200,7 @@ 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: # make call to next link with the client's api-version @@ -218,7 +216,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", 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 @@ -246,12 +245,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} @distributed_trace_async async def get(self, view_name: str, **kwargs: Any) -> _models.View: """Gets the view by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -270,10 +272,8 @@ async def get(self, view_name: str, **kwargs: Any) -> _models.View: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_request( view_name=view_name, @@ -283,10 +283,11 @@ async def get(self, view_name: str, **kwargs: Any) -> _models.View: 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 @@ -303,7 +304,7 @@ async def get(self, view_name: str, **kwargs: Any) -> _models.View: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @overload async def create_or_update( @@ -313,6 +314,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -334,6 +338,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -355,9 +362,12 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -379,11 +389,9 @@ async def 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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -404,10 +412,11 @@ async def create_or_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 @@ -424,16 +433,19 @@ async def create_or_update( deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace_async async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -452,10 +464,8 @@ async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disabl _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( view_name=view_name, @@ -465,10 +475,11 @@ async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disabl 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 @@ -481,12 +492,15 @@ async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disabl if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace_async async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.View: """Gets the view for the defined scope by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -523,10 +537,8 @@ async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -537,10 +549,11 @@ async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _mode 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 @@ -557,7 +570,7 @@ async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _mode return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @overload async def create_or_update_by_scope( @@ -573,6 +586,9 @@ async def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -612,6 +628,9 @@ async def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -651,6 +670,9 @@ async def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -671,7 +693,7 @@ async def create_or_update_by_scope( :type scope: str :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -693,11 +715,9 @@ async def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -719,10 +739,11 @@ async def create_or_update_by_scope( 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 @@ -739,11 +760,11 @@ async def create_or_update_by_scope( deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace_async async def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -751,6 +772,9 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -787,10 +811,8 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -801,10 +823,11 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements 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 @@ -817,4 +840,4 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py index aade15c2f223..be704298e815 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py @@ -33,7 +33,9 @@ from ._models_py3 import DismissAlertPayload from ._models_py3 import DownloadURL from ._models_py3 import ErrorDetails +from ._models_py3 import ErrorDetailsWithNestedDetails from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseWithNestedDetails from ._models_py3 import Export from ._models_py3 import ExportDataset from ._models_py3 import ExportDatasetConfiguration @@ -149,7 +151,6 @@ from ._cost_management_client_enums import QueryColumnType from ._cost_management_client_enums import QueryOperatorType from ._cost_management_client_enums import RecurrenceType -from ._cost_management_client_enums import ReportConfigColumnType from ._cost_management_client_enums import ReportConfigSortingType from ._cost_management_client_enums import ReportGranularityType from ._cost_management_client_enums import ReportOperationStatusType @@ -165,7 +166,7 @@ from ._cost_management_client_enums import TimeframeType from ._cost_management_client_enums import WeeksOfMonth 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__ = [ @@ -196,7 +197,9 @@ "DismissAlertPayload", "DownloadURL", "ErrorDetails", + "ErrorDetailsWithNestedDetails", "ErrorResponse", + "ErrorResponseWithNestedDetails", "Export", "ExportDataset", "ExportDatasetConfiguration", @@ -311,7 +314,6 @@ "QueryColumnType", "QueryOperatorType", "RecurrenceType", - "ReportConfigColumnType", "ReportConfigSortingType", "ReportGranularityType", "ReportOperationStatusType", diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py index 0dbdb4a13835..400e59765fb6 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py @@ -106,12 +106,12 @@ class AlertType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class BenefitKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Kind/type of the benefit.""" - #: Benefit is IncludedQuantity. INCLUDED_QUANTITY = "IncludedQuantity" - #: Benefit is Reservation. + """Benefit is IncludedQuantity.""" RESERVATION = "Reservation" - #: Benefit is SavingsPlan. + """Benefit is Reservation.""" SAVINGS_PLAN = "SavingsPlan" + """Benefit is SavingsPlan.""" class ChartType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -134,28 +134,28 @@ class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CostDetailsDataFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The data format of the report.""" - #: Csv data format. CSV_COST_DETAILS_DATA_FORMAT = "Csv" + """Csv data format.""" class CostDetailsMetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the detailed report. By default ActualCost is provided.""" - #: Actual cost data. ACTUAL_COST_COST_DETAILS_METRIC_TYPE = "ActualCost" - #: Amortized cost data. + """Actual cost data.""" AMORTIZED_COST_COST_DETAILS_METRIC_TYPE = "AmortizedCost" + """Amortized cost data.""" class CostDetailsStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the cost details operation.""" - #: Operation is Completed. COMPLETED_COST_DETAILS_STATUS_TYPE = "Completed" - #: Operation is Completed and no cost data found. + """Operation is Completed.""" NO_DATA_FOUND_COST_DETAILS_STATUS_TYPE = "NoDataFound" - #: Operation Failed. + """Operation is Completed and no cost data found.""" FAILED_COST_DETAILS_STATUS_TYPE = "Failed" + """Operation Failed.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -223,6 +223,7 @@ class ForecastOperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operator to use for comparison.""" IN = "In" + IN_ENUM = "In" class ForecastTimeframe(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -270,23 +271,23 @@ class GenerateDetailedCostReportMetricType(str, Enum, metaclass=CaseInsensitiveE class Grain(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Grain which corresponds to value.""" - #: Hourly grain corresponds to value per hour. HOURLY = "Hourly" - #: Hourly grain corresponds to value per day. + """Hourly grain corresponds to value per hour.""" DAILY = "Daily" - #: Hourly grain corresponds to value per month. + """Hourly grain corresponds to value per day.""" MONTHLY = "Monthly" + """Hourly grain corresponds to value per month.""" class GrainParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GrainParameter.""" - #: Hourly grain corresponds to value per hour. HOURLY = "Hourly" - #: Hourly grain corresponds to value per day. + """Hourly grain corresponds to value per hour.""" DAILY = "Daily" - #: Hourly grain corresponds to value per month. + """Hourly grain corresponds to value per day.""" MONTHLY = "Monthly" + """Hourly grain corresponds to value per month.""" class GranularityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -305,12 +306,12 @@ class KpiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class LookBackPeriod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The number of days used to look back.""" - #: 7 days used to look back. LAST7_DAYS = "Last7Days" - #: 30 days used to look back. + """7 days used to look back.""" LAST30_DAYS = "Last30Days" - #: 60 days used to look back. + """30 days used to look back.""" LAST60_DAYS = "Last60Days" + """60 days used to look back.""" class MetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -334,6 +335,7 @@ class OperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): IN = "In" CONTAINS = "Contains" + IN_ENUM = "In" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -354,16 +356,19 @@ class PivotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class QueryColumnType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the column in the export.""" + """The type of the column in the report.""" - TAG = "Tag" + TAG_KEY = "TagKey" + """The tag associated with the cost data.""" DIMENSION = "Dimension" + """The dimension of cost data.""" class QueryOperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operator to use for comparison.""" IN = "In" + IN_ENUM = "In" class RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -375,13 +380,6 @@ class RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ANNUALLY = "Annually" -class ReportConfigColumnType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the column in the report.""" - - TAG = "Tag" - DIMENSION = "Dimension" - - class ReportConfigSortingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Direction of sort.""" @@ -449,42 +447,42 @@ class ReservationReportSchema(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ScheduledActionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Kind of the scheduled action.""" - #: Cost analysis data will be emailed. EMAIL = "Email" - #: Cost anomaly information will be emailed. Available only on subscription scope at daily - #: frequency. If no anomaly is detected on the resource, an email won't be sent. + """Cost analysis data will be emailed.""" INSIGHT_ALERT = "InsightAlert" + """Cost anomaly information will be emailed. Available only on subscription scope at daily + #: frequency. If no anomaly is detected on the resource, an email won't be sent.""" class ScheduledActionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the scheduled action.""" - #: Scheduled action is saved but will not be run. DISABLED = "Disabled" - #: Scheduled action is saved and will be run. + """Scheduled action is saved but will not be run.""" ENABLED = "Enabled" - #: Scheduled action is expired. + """Scheduled action is saved and will be run.""" EXPIRED = "Expired" + """Scheduled action is expired.""" class ScheduleFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Frequency of the schedule.""" - #: Cost analysis data will be emailed every day. DAILY = "Daily" - #: Cost analysis data will be emailed every week. + """Cost analysis data will be emailed every day.""" WEEKLY = "Weekly" - #: Cost analysis data will be emailed every month. + """Cost analysis data will be emailed every week.""" MONTHLY = "Monthly" + """Cost analysis data will be emailed every month.""" class Scope(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Kind of the recommendation scope.""" - #: Single scope recommendation. SINGLE = "Single" - #: Shared scope recommendation. + """Single scope recommendation.""" SHARED = "Shared" + """Shared scope recommendation.""" class StatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -497,10 +495,10 @@ class StatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Term(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Grain which corresponds to value.""" - #: Benefit term is 1 year. P1_Y = "P1Y" - #: Benefit term is 3 years. + """Benefit term is 1 year.""" P3_Y = "P3Y" + """Benefit term is 3 years.""" class TimeframeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py index 94017df1f517..4fea158c9f8a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py @@ -53,7 +53,7 @@ class CostManagementProxyResource(_serialization.Model): "e_tag": {"key": "eTag", "type": "str"}, } - def __init__(self, *, e_tag: Optional[str] = None, **kwargs): + def __init__(self, *, e_tag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -144,8 +144,8 @@ def __init__( modification_time: Optional[str] = None, status_modification_user_name: Optional[str] = None, status_modification_time: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -217,8 +217,8 @@ def __init__( type: Optional[Union[str, "_models.AlertType"]] = None, category: Optional[Union[str, "_models.AlertCategory"]] = None, criteria: Optional[Union[str, "_models.AlertCriteria"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: type of alert. Known values are: "Budget", "Invoice", "Credit", "Quota", "General", "xCloud", and "BudgetForecast". @@ -340,8 +340,8 @@ def __init__( enrollment_start_date: Optional[str] = None, enrollment_end_date: Optional[str] = None, invoicing_threshold: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword time_grain_type: Type of timegrain cadence. Known values are: "None", "Monthly", "Quarterly", "Annually", "BillingMonth", "BillingQuarter", and "BillingAnnual". @@ -436,7 +436,7 @@ class AlertsResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -498,7 +498,7 @@ class AllSavingsBenefitDetails(_serialization.Model): "wastage_cost": {"key": "wastageCost", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.overage_cost = None @@ -533,7 +533,7 @@ class AllSavingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -567,7 +567,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 @@ -606,7 +606,7 @@ class BenefitResource(Resource): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, kind: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword kind: Reservation or SavingsPlan. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -655,8 +655,8 @@ def __init__( *, kind: Optional[Union[str, "_models.BenefitKind"]] = None, properties: Optional["_models.BenefitRecommendationProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Reservation or SavingsPlan. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -758,8 +758,8 @@ def __init__( term: Optional[Union[str, "_models.Term"]] = None, commitment_granularity: Optional[Union[str, "_models.Grain"]] = None, recommendation_details: Optional["_models.AllSavingsBenefitDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword look_back_period: The number of days of usage evaluated for computing the recommendations. Known values are: "Last7Days", "Last30Days", and "Last60Days". @@ -789,7 +789,7 @@ def __init__( self.cost_without_benefit = None self.recommendation_details = recommendation_details self.all_recommendation_details = None - self.scope = None # type: Optional[str] + self.scope: Optional[str] = None class BenefitRecommendationsListResult(_serialization.Model): @@ -813,7 +813,7 @@ class BenefitRecommendationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -841,7 +841,7 @@ class BenefitUtilizationSummariesListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -892,10 +892,10 @@ class BenefitUtilizationSummary(Resource): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class BenefitUtilizationSummaryProperties(_serialization.Model): @@ -932,7 +932,7 @@ class BenefitUtilizationSummaryProperties(_serialization.Model): "usage_date": {"key": "usageDate", "type": "iso-8601"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -960,7 +960,7 @@ class BlobInfo(_serialization.Model): "byte_count": {"key": "byteCount", "type": "int"}, } - def __init__(self, *, blob_link: Optional[str] = None, byte_count: Optional[int] = None, **kwargs): + def __init__(self, *, blob_link: Optional[str] = None, byte_count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword blob_link: Link to the blob to download file. :paramtype blob_link: str @@ -986,7 +986,7 @@ class CheckNameAvailabilityRequest(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the resource for which availability needs to be checked. :paramtype name: str @@ -1022,8 +1022,8 @@ def __init__( name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Indicates if the resource name is available. :paramtype name_available: bool @@ -1087,8 +1087,8 @@ def __init__( format: Optional[Union[str, "_models.FormatType"]] = None, run_history: Optional["_models.ExportExecutionListResult"] = None, partition_data: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword format: The format of the export being delivered. Currently only 'Csv' is supported. "Csv" @@ -1186,8 +1186,8 @@ def __init__( blobs: Optional[List["_models.BlobInfo"]] = None, request_scope: Optional[str] = None, request_body: Optional["_models.GenerateCostDetailsReportRequestDefinition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the long running operation. :paramtype id: str @@ -1239,7 +1239,8 @@ def __init__( class CostDetailsTimePeriod(_serialization.Model): - """The start and end date for pulling data for the cost detailed report. API only allows data to be pulled for 1 month or less and no older than 13 months. + """The start and end date for pulling data for the cost detailed report. API only allows data to + be pulled for 1 month or less and no older than 13 months. All required parameters must be populated in order to send to Azure. @@ -1259,7 +1260,7 @@ class CostDetailsTimePeriod(_serialization.Model): "end": {"key": "end", "type": "str"}, } - def __init__(self, *, start: str, end: str, **kwargs): + def __init__(self, *, start: str, end: str, **kwargs: Any) -> None: """ :keyword start: The start date to pull data from. example format 2020-03-15. Required. :paramtype start: str @@ -1308,7 +1309,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.costmanagement.models.OperationDisplay @@ -1362,7 +1363,7 @@ class CostManagementOperation(Operation): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.costmanagement.models.OperationDisplay @@ -1412,7 +1413,7 @@ class CostManagementResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1500,7 +1501,7 @@ class Dimension(CostManagementResource): # pylint: disable=too-many-instance-at "next_link": {"key": "properties.nextLink", "type": "str"}, } - def __init__(self, *, data: Optional[List[str]] = None, **kwargs): + def __init__(self, *, data: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword data: Dimension data. :paramtype data: list[str] @@ -1534,7 +1535,7 @@ class DimensionsListResult(_serialization.Model): "value": {"key": "value", "type": "[Dimension]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1596,8 +1597,8 @@ def __init__( modification_time: Optional[str] = None, status_modification_user_name: Optional[str] = None, status_modification_time: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword definition: defines the type of alert. :paramtype definition: ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition @@ -1662,7 +1663,9 @@ class DownloadURL(_serialization.Model): "download_url": {"key": "downloadUrl", "type": "str"}, } - def __init__(self, *, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, **kwargs): + def __init__( + self, *, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword valid_till: The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. @@ -1697,34 +1700,68 @@ class ErrorDetails(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None self.message = None +class ErrorDetailsWithNestedDetails(ErrorDetails): + """The details of the error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar details: The additional details of the error. + :vartype details: list[~azure.mgmt.costmanagement.models.ErrorDetailsWithNestedDetails] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetailsWithNestedDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.details = None + + 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. Some Error responses: * - 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "x-ms-ratelimit-microsoft.consumption-retry-after" header. * - 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. - :ivar error: The details of the error. - :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _attribute_map = { "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.costmanagement.models.ErrorDetails @@ -1733,6 +1770,38 @@ def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs): self.error = error +class ErrorResponseWithNestedDetails(_serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. + + Some Error responses: + + + * + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "x-ms-ratelimit-microsoft.consumption-retry-after" header. + + * + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. + + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetailsWithNestedDetails + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetailsWithNestedDetails"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetailsWithNestedDetails"] = None, **kwargs: Any) -> None: + """ + :keyword error: The details of the error. + :paramtype error: ~azure.mgmt.costmanagement.models.ErrorDetailsWithNestedDetails + """ + super().__init__(**kwargs) + self.error = error + + class Export(CostManagementProxyResource): # pylint: disable=too-many-instance-attributes """An export resource. @@ -1798,8 +1867,8 @@ def __init__( run_history: Optional["_models.ExportExecutionListResult"] = None, partition_data: Optional[bool] = None, schedule: Optional["_models.ExportSchedule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -1850,8 +1919,8 @@ def __init__( *, granularity: Optional[Union[str, "_models.GranularityType"]] = None, configuration: Optional["_models.ExportDatasetConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the export. Currently only 'Daily' is supported. "Daily" @@ -1865,7 +1934,8 @@ def __init__( class ExportDatasetConfiguration(_serialization.Model): - """The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns. + """The export dataset configuration. Allows columns to be selected for the export. If not provided + then the export will include all available columns. :ivar columns: Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel @@ -1877,7 +1947,7 @@ class ExportDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel @@ -1926,8 +1996,8 @@ def __init__( timeframe: Union[str, "_models.TimeframeType"], time_period: Optional["_models.ExportTimePeriod"] = None, data_set: Optional["_models.ExportDataset"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service @@ -1950,7 +2020,22 @@ def __init__( class ExportDeliveryDestination(_serialization.Model): - """This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ). + """This represents the blob storage account location where exports of costs will be delivered. + There are two ways to configure the destination. The approach recommended for most customers is + to specify the resourceId of the storage account. This requires a one-time registration of the + account's subscription with the Microsoft.CostManagementExports resource provider in order to + give Cost Management services access to the storage. When creating an export in the Azure + portal this registration is performed automatically but API users may need to register the + subscription explicitly (for more information see + https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services + ). Another way to configure the destination is available ONLY to Partners with a Microsoft + Partner Agreement plan who are global admins of their billing account. These Partners, instead + of specifying the resourceId of a storage account, can specify the storage account name along + with a SAS token for the account. This allows exports of costs to a storage account in any + tenant. The SAS token should be created for the blob service with Service/Container/Object + resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see + https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key + ). All required parameters must be populated in order to send to Azure. @@ -1993,8 +2078,8 @@ def __init__( root_folder_path: Optional[str] = None, sas_token: Optional[str] = None, storage_account: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified. @@ -2039,7 +2124,7 @@ class ExportDeliveryInfo(_serialization.Model): "destination": {"key": "destination", "type": "ExportDeliveryDestination"}, } - def __init__(self, *, destination: "_models.ExportDeliveryDestination", **kwargs): + def __init__(self, *, destination: "_models.ExportDeliveryDestination", **kwargs: Any) -> None: """ :keyword destination: Has destination for the export being delivered. Required. :paramtype destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination @@ -2065,7 +2150,7 @@ class ExportExecutionListResult(_serialization.Model): "value": {"key": "value", "type": "[ExportRun]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2088,7 +2173,7 @@ class ExportListResult(_serialization.Model): "value": {"key": "value", "type": "[Export]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2146,8 +2231,8 @@ def __init__( run_history: Optional["_models.ExportExecutionListResult"] = None, partition_data: Optional[bool] = None, schedule: Optional["_models.ExportSchedule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword format: The format of the export being delivered. Currently only 'Csv' is supported. "Csv" @@ -2196,7 +2281,9 @@ class ExportRecurrencePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: Optional[datetime.datetime] = None, **kwargs): + def __init__( + self, *, from_property: datetime.datetime, to: Optional[datetime.datetime] = None, **kwargs: Any + ) -> None: """ :keyword from_property: The start date of recurrence. Required. :paramtype from_property: ~datetime.datetime @@ -2279,8 +2366,8 @@ def __init__( file_name: Optional[str] = None, run_settings: Optional["_models.CommonExportProperties"] = None, error: Optional["_models.ErrorDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -2345,8 +2432,8 @@ def __init__( status: Optional[Union[str, "_models.StatusType"]] = None, recurrence: Optional[Union[str, "_models.RecurrenceType"]] = None, recurrence_period: Optional["_models.ExportRecurrencePeriod"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of the export's schedule. If 'Inactive', the export's schedule is paused. Known values are: "Active" and "Inactive". @@ -2365,7 +2452,8 @@ def __init__( class ExportTimePeriod(_serialization.Model): - """The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months. + """The date range for data in the export. This should only be specified with timeFrame set to + 'Custom'. The maximum date range is 3 months. All required parameters must be populated in order to send to Azure. @@ -2385,7 +2473,7 @@ class ExportTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date for export data. Required. :paramtype from_property: ~datetime.datetime @@ -2408,7 +2496,7 @@ class FileDestination(_serialization.Model): "file_formats": {"key": "fileFormats", "type": "[str]"}, } - def __init__(self, *, file_formats: Optional[List[Union[str, "_models.FileFormat"]]] = None, **kwargs): + def __init__(self, *, file_formats: Optional[List[Union[str, "_models.FileFormat"]]] = None, **kwargs: Any) -> None: """ :keyword file_formats: Destination of the view data. Currently only CSV format is supported. :paramtype file_formats: list[str or ~azure.mgmt.costmanagement.models.FileFormat] @@ -2440,8 +2528,8 @@ class ForecastAggregation(_serialization.Model): } def __init__( - self, *, name: Union[str, "_models.FunctionName"], function: Union[str, "_models.FunctionType"], **kwargs - ): + self, *, name: Union[str, "_models.FunctionName"], function: Union[str, "_models.FunctionType"], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to aggregate. Required. Known values are: "PreTaxCostUSD", "Cost", "CostUSD", and "PreTaxCost". @@ -2468,7 +2556,7 @@ class ForecastColumn(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of column. :paramtype name: str @@ -2487,7 +2575,7 @@ class ForecastComparisonExpression(_serialization.Model): :ivar name: The name of the column to use in comparison. Required. :vartype name: str - :ivar operator: The operator to use for comparison. Required. "In" + :ivar operator: The operator to use for comparison. Required. Known values are: "In" and "In". :vartype operator: str or ~azure.mgmt.costmanagement.models.ForecastOperatorType :ivar values: Array of values to use for comparison. Required. :vartype values: list[str] @@ -2505,11 +2593,14 @@ class ForecastComparisonExpression(_serialization.Model): "values": {"key": "values", "type": "[str]"}, } - def __init__(self, *, name: str, operator: Union[str, "_models.ForecastOperatorType"], values: List[str], **kwargs): + def __init__( + self, *, name: str, operator: Union[str, "_models.ForecastOperatorType"], values: List[str], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to use in comparison. Required. :paramtype name: str - :keyword operator: The operator to use for comparison. Required. "In" + :keyword operator: The operator to use for comparison. Required. Known values are: "In" and + "In". :paramtype operator: str or ~azure.mgmt.costmanagement.models.ForecastOperatorType :keyword values: Array of values to use for comparison. Required. :paramtype values: list[str] @@ -2556,8 +2647,8 @@ def __init__( granularity: Optional[Union[str, "_models.GranularityType"]] = None, configuration: Optional["_models.ForecastDatasetConfiguration"] = None, filter: Optional["_models.ForecastFilter"] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the forecast. "Daily" :paramtype granularity: str or ~azure.mgmt.costmanagement.models.GranularityType @@ -2590,7 +2681,7 @@ class ForecastDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns. @@ -2645,8 +2736,8 @@ def __init__( time_period: Optional["_models.ForecastTimePeriod"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the forecast. Required. Known values are: "Usage", "ActualCost", and "AmortizedCost". @@ -2705,8 +2796,8 @@ def __init__( or_property: Optional[List["_models.ForecastFilter"]] = None, dimensions: Optional["_models.ForecastComparisonExpression"] = None, tags: Optional["_models.ForecastComparisonExpression"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword and_property: The logical "AND" expression. Must have at least 2 items. :paramtype and_property: list[~azure.mgmt.costmanagement.models.ForecastFilter] @@ -2780,8 +2871,8 @@ def __init__( next_link: Optional[str] = None, columns: Optional[List["_models.ForecastColumn"]] = None, rows: Optional[List[List[Any]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link (url) to the next page of results. :paramtype next_link: str @@ -2817,7 +2908,7 @@ class ForecastTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date to pull data from. Required. :paramtype from_property: ~datetime.datetime @@ -2830,38 +2921,46 @@ def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, * class GenerateCostDetailsReportErrorResponse(_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. Some Error responses: * - 400 Bad Request - Invalid Request Payload. Request payload provided is not in a json format or had an invalid member not accepted in the request payload. + 400 Bad Request - Invalid Request Payload. Request payload provided is not in a json format + or had an invalid member not accepted in the request payload. * - 400 Bad Request - Invalid request payload: can only have either timePeriod or invoiceId or billingPeriod. API only allows data to be pulled for either timePeriod or invoiceId or billingPeriod. Customer should provide only one of these parameters. + 400 Bad Request - Invalid request payload: can only have either timePeriod or invoiceId or + billingPeriod. API only allows data to be pulled for either timePeriod or invoiceId or + billingPeriod. Customer should provide only one of these parameters. * - 400 Bad Request - Start date must be after . API only allows data to be pulled no older than 13 months from now. + 400 Bad Request - Start date must be after . API only allows data to be pulled no older than + 13 months from now. * - 400 Bad Request - The maximum allowed date range is 1 months. API only allows data to be pulled for 1 month or less. + 400 Bad Request - The maximum allowed date range is 1 months. API only allows data to be + pulled for 1 month or less. * - 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "retry-after" header. + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "retry-after" header. * - 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. - :ivar error: The details of the error. - :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _attribute_map = { "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.costmanagement.models.ErrorDetails @@ -2910,8 +3009,8 @@ def __init__( time_period: Optional["_models.CostDetailsTimePeriod"] = None, billing_period: Optional[str] = None, invoice_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric: The type of the detailed report. By default ActualCost is provided. Known values are: "ActualCost" and "AmortizedCost". @@ -2981,8 +3080,8 @@ def __init__( billing_period: Optional[str] = None, invoice_id: Optional[str] = None, customer_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric: The type of the detailed report. By default ActualCost is provided. Known values are: "ActualCost" and "AmortizedCost". @@ -3013,29 +3112,34 @@ def __init__( class GenerateDetailedCostReportErrorResponse(_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. Some Error responses: * - 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature instead. + 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill + the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature + instead. * - 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "x-ms-ratelimit-microsoft.consumption-retry-after" header. * - 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. - :ivar error: The details of the error. - :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _attribute_map = { "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.costmanagement.models.ErrorDetails @@ -3086,8 +3190,8 @@ def __init__( type: Optional[str] = None, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ARM resource id of the long running operation. :paramtype id: str @@ -3121,6 +3225,10 @@ class GenerateDetailedCostReportOperationStatuses(_serialization.Model): :vartype name: str :ivar status: The status of the long running operation. :vartype status: ~azure.mgmt.costmanagement.models.Status + :ivar start_time: The startTime of the operation. + :vartype start_time: str + :ivar end_time: The endTime of the operation. + :vartype end_time: str :ivar type: The type of the long running operation. :vartype type: str :ivar error: The details of the error. @@ -3143,6 +3251,8 @@ class GenerateDetailedCostReportOperationStatuses(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "status": {"key": "status", "type": "Status"}, + "start_time": {"key": "startTime", "type": "str"}, + "end_time": {"key": "endTime", "type": "str"}, "type": {"key": "type", "type": "str"}, "error": {"key": "error", "type": "ErrorDetails"}, "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, @@ -3156,12 +3266,14 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, status: Optional["_models.Status"] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, type: Optional[str] = None, error: Optional["_models.ErrorDetails"] = None, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the long running operation. :paramtype id: str @@ -3169,6 +3281,10 @@ def __init__( :paramtype name: str :keyword status: The status of the long running operation. :paramtype status: ~azure.mgmt.costmanagement.models.Status + :keyword start_time: The startTime of the operation. + :paramtype start_time: str + :keyword end_time: The endTime of the operation. + :paramtype end_time: str :keyword type: The type of the long running operation. :paramtype type: str :keyword error: The details of the error. @@ -3183,6 +3299,8 @@ def __init__( self.id = id self.name = name self.status = status + self.start_time = start_time + self.end_time = end_time self.type = type self.error = error self.expiry_time = None @@ -3211,7 +3329,7 @@ class GenerateDetailedCostReportTimePeriod(_serialization.Model): "end": {"key": "end", "type": "str"}, } - def __init__(self, *, start: str, end: str, **kwargs): + def __init__(self, *, start: str, end: str, **kwargs: Any) -> None: """ :keyword start: The start date to pull data from. example format 2020-03-15. Required. :paramtype start: str @@ -3282,14 +3400,14 @@ class IncludedQuantityUtilizationSummary(BenefitUtilizationSummary): "utilization_percentage": {"key": "properties.utilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". :paramtype benefit_type: str or ~azure.mgmt.costmanagement.models.BenefitKind """ super().__init__(**kwargs) - self.kind = "IncludedQuantity" # type: str + self.kind: str = "IncludedQuantity" self.arm_sku_name = None self.benefit_id = None self.benefit_order_id = None @@ -3336,7 +3454,7 @@ class IncludedQuantityUtilizationSummaryProperties(BenefitUtilizationSummaryProp "utilization_percentage": {"key": "utilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -3369,8 +3487,8 @@ def __init__( type: Optional[Union[str, "_models.KpiType"]] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: KPI type (Forecast, Budget). Known values are: "Forecast" and "Budget". :paramtype type: str or ~azure.mgmt.costmanagement.models.KpiType @@ -3424,8 +3542,8 @@ def __init__( language: Optional[str] = None, message: Optional[str] = None, regional_format: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword to: Array of email addresses. Required. :paramtype to: list[str] @@ -3481,7 +3599,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 @@ -3491,7 +3609,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results. + """Result of listing cost management operations. It contains a list of operations and a URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -3512,7 +3631,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 @@ -3546,8 +3665,8 @@ def __init__( status: Optional[Union[str, "_models.OperationStatusType"]] = None, report_url: Optional[Union[str, "_models.ReservationReportSchema"]] = None, valid_until: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of the long running operation. Known values are: "Running", "Completed", and "Failed". @@ -3581,7 +3700,9 @@ class PivotProperties(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.PivotType"]] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, *, type: Optional[Union[str, "_models.PivotType"]] = None, name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword type: Data type to show in view. Known values are: "Dimension" and "TagKey". :paramtype type: str or ~azure.mgmt.costmanagement.models.PivotType @@ -3594,7 +3715,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.PivotType"]] = None, na class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -3620,7 +3742,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -3646,7 +3768,7 @@ class QueryAggregation(_serialization.Model): "function": {"key": "function", "type": "str"}, } - def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs): + def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs: Any) -> None: """ :keyword name: The name of the column to aggregate. Required. :paramtype name: str @@ -3672,7 +3794,7 @@ class QueryColumn(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of column. :paramtype name: str @@ -3691,7 +3813,7 @@ class QueryComparisonExpression(_serialization.Model): :ivar name: The name of the column to use in comparison. Required. :vartype name: str - :ivar operator: The operator to use for comparison. Required. "In" + :ivar operator: The operator to use for comparison. Required. Known values are: "In" and "In". :vartype operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :ivar values: Array of values to use for comparison. Required. :vartype values: list[str] @@ -3709,11 +3831,14 @@ class QueryComparisonExpression(_serialization.Model): "values": {"key": "values", "type": "[str]"}, } - def __init__(self, *, name: str, operator: Union[str, "_models.QueryOperatorType"], values: List[str], **kwargs): + def __init__( + self, *, name: str, operator: Union[str, "_models.QueryOperatorType"], values: List[str], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to use in comparison. Required. :paramtype name: str - :keyword operator: The operator to use for comparison. Required. "In" + :keyword operator: The operator to use for comparison. Required. Known values are: "In" and + "In". :paramtype operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :keyword values: Array of values to use for comparison. Required. :paramtype values: list[str] @@ -3764,8 +3889,8 @@ def __init__( aggregation: Optional[Dict[str, "_models.QueryAggregation"]] = None, grouping: Optional[List["_models.QueryGrouping"]] = None, filter: Optional["_models.QueryFilter"] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the query. "Daily" :paramtype granularity: str or ~azure.mgmt.costmanagement.models.GranularityType @@ -3803,7 +3928,7 @@ class QueryDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query includes all columns. @@ -3851,8 +3976,8 @@ def __init__( timeframe: Union[str, "_models.TimeframeType"], dataset: "_models.QueryDataset", time_period: Optional["_models.QueryTimePeriod"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the query. Required. Known values are: "Usage", "ActualCost", and "AmortizedCost". @@ -3905,8 +4030,8 @@ def __init__( or_property: Optional[List["_models.QueryFilter"]] = None, dimensions: Optional["_models.QueryComparisonExpression"] = None, tags: Optional["_models.QueryComparisonExpression"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword and_property: The logical "AND" expression. Must have at least 2 items. :paramtype and_property: list[~azure.mgmt.costmanagement.models.QueryFilter] @@ -3929,7 +4054,8 @@ class QueryGrouping(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Has type of the column to group. Required. Known values are: "Tag" and "Dimension". + :ivar type: Has type of the column to group. Required. Known values are: "TagKey" and + "Dimension". :vartype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :ivar name: The name of the column to group. Required. :vartype name: str @@ -3945,9 +4071,9 @@ class QueryGrouping(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.QueryColumnType"], name: str, **kwargs): + def __init__(self, *, type: Union[str, "_models.QueryColumnType"], name: str, **kwargs: Any) -> None: """ - :keyword type: Has type of the column to group. Required. Known values are: "Tag" and + :keyword type: Has type of the column to group. Required. Known values are: "TagKey" and "Dimension". :paramtype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :keyword name: The name of the column to group. Required. @@ -4014,8 +4140,8 @@ def __init__( next_link: Optional[str] = None, columns: Optional[List["_models.QueryColumn"]] = None, rows: Optional[List[List[Any]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link (url) to the next page of results. :paramtype next_link: str @@ -4051,7 +4177,7 @@ class QueryTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date to pull data from. Required. :paramtype from_property: ~datetime.datetime @@ -4064,7 +4190,8 @@ def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, * class RecommendationUsageDetails(_serialization.Model): - """On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + """On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for + computing benefit recommendations. Variables are only populated by the server, and will be ignored when sending a request. @@ -4085,7 +4212,7 @@ class RecommendationUsageDetails(_serialization.Model): "charges": {"key": "charges", "type": "[float]"}, } - def __init__(self, *, usage_grain: Optional[Union[str, "_models.Grain"]] = None, **kwargs): + def __init__(self, *, usage_grain: Optional[Union[str, "_models.Grain"]] = None, **kwargs: Any) -> None: """ :keyword usage_grain: The grain of the usage. Supported values: 'Hourly'. Known values are: "Hourly", "Daily", and "Monthly". @@ -4117,7 +4244,7 @@ class ReportConfigAggregation(_serialization.Model): "function": {"key": "function", "type": "str"}, } - def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs): + def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs: Any) -> None: """ :keyword name: The name of the column to aggregate. Required. :paramtype name: str @@ -4136,8 +4263,8 @@ class ReportConfigComparisonExpression(_serialization.Model): :ivar name: The name of the column to use in comparison. Required. :vartype name: str - :ivar operator: The operator to use for comparison. Required. Known values are: "In" and - "Contains". + :ivar operator: The operator to use for comparison. Required. Known values are: "In", + "Contains", and "In". :vartype operator: str or ~azure.mgmt.costmanagement.models.OperatorType :ivar values: Array of values to use for comparison. Required. :vartype values: list[str] @@ -4155,12 +4282,14 @@ class ReportConfigComparisonExpression(_serialization.Model): "values": {"key": "values", "type": "[str]"}, } - def __init__(self, *, name: str, operator: Union[str, "_models.OperatorType"], values: List[str], **kwargs): + def __init__( + self, *, name: str, operator: Union[str, "_models.OperatorType"], values: List[str], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to use in comparison. Required. :paramtype name: str - :keyword operator: The operator to use for comparison. Required. Known values are: "In" and - "Contains". + :keyword operator: The operator to use for comparison. Required. Known values are: "In", + "Contains", and "In". :paramtype operator: str or ~azure.mgmt.costmanagement.models.OperatorType :keyword values: Array of values to use for comparison. Required. :paramtype values: list[str] @@ -4215,8 +4344,8 @@ def __init__( grouping: Optional[List["_models.ReportConfigGrouping"]] = None, sorting: Optional[List["_models.ReportConfigSorting"]] = None, filter: Optional["_models.ReportConfigFilter"] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the report. Known values are: "Daily" and "Monthly". @@ -4257,7 +4386,7 @@ class ReportConfigDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report includes all columns. @@ -4299,8 +4428,8 @@ def __init__( or_property: Optional[List["_models.ReportConfigFilter"]] = None, dimensions: Optional["_models.ReportConfigComparisonExpression"] = None, tags: Optional["_models.ReportConfigComparisonExpression"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword and_property: The logical "AND" expression. Must have at least 2 items. :paramtype and_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilter] @@ -4323,8 +4452,9 @@ class ReportConfigGrouping(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Has type of the column to group. Required. Known values are: "Tag" and "Dimension". - :vartype type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :ivar type: Has type of the column to group. Required. Known values are: "TagKey" and + "Dimension". + :vartype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :ivar name: The name of the column to group. This version supports subscription lowest possible grain. Required. :vartype name: str @@ -4340,11 +4470,11 @@ class ReportConfigGrouping(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.ReportConfigColumnType"], name: str, **kwargs): + def __init__(self, *, type: Union[str, "_models.QueryColumnType"], name: str, **kwargs: Any) -> None: """ - :keyword type: Has type of the column to group. Required. Known values are: "Tag" and + :keyword type: Has type of the column to group. Required. Known values are: "TagKey" and "Dimension". - :paramtype type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :paramtype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :keyword name: The name of the column to group. This version supports subscription lowest possible grain. Required. :paramtype name: str @@ -4375,8 +4505,8 @@ class ReportConfigSorting(_serialization.Model): } def __init__( - self, *, name: str, direction: Optional[Union[str, "_models.ReportConfigSortingType"]] = None, **kwargs - ): + self, *, name: str, direction: Optional[Union[str, "_models.ReportConfigSortingType"]] = None, **kwargs: Any + ) -> None: """ :keyword direction: Direction of sort. Known values are: "Ascending" and "Descending". :paramtype direction: str or ~azure.mgmt.costmanagement.models.ReportConfigSortingType @@ -4409,7 +4539,7 @@ class ReportConfigTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date to pull data from. Required. :paramtype from_property: ~datetime.datetime @@ -4505,14 +4635,14 @@ class SavingsPlanUtilizationSummary(BenefitUtilizationSummary): # pylint: disab "max_utilization_percentage": {"key": "properties.maxUtilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". :paramtype benefit_type: str or ~azure.mgmt.costmanagement.models.BenefitKind """ super().__init__(**kwargs) - self.kind = "SavingsPlan" # type: str + self.kind: str = "SavingsPlan" self.arm_sku_name = None self.benefit_id = None self.benefit_order_id = None @@ -4586,7 +4716,7 @@ class SavingsPlanUtilizationSummaryProperties(BenefitUtilizationSummaryPropertie "max_utilization_percentage": {"key": "maxUtilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -4611,7 +4741,10 @@ class ScheduledActionProxyResource(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar e_tag: Resource Etag. + :ivar e_tag: Resource Etag. For update calls, eTag is optional and can be specified to achieve + optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then + including the latest eTag as part of the request body or 'If-Match' header while performing the + update. For create calls, eTag is not required. :vartype e_tag: str :ivar kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :vartype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4636,7 +4769,7 @@ class ScheduledActionProxyResource(ProxyResource): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.ScheduledActionKind"]] = None, **kwargs): + def __init__(self, *, kind: Optional[Union[str, "_models.ScheduledActionKind"]] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :paramtype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4660,7 +4793,10 @@ class ScheduledAction(ScheduledActionProxyResource): # pylint: disable=too-many :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar e_tag: Resource Etag. + :ivar e_tag: Resource Etag. For update calls, eTag is optional and can be specified to achieve + optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then + including the latest eTag as part of the request body or 'If-Match' header while performing the + update. For create calls, eTag is not required. :vartype e_tag: str :ivar kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :vartype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4739,8 +4875,8 @@ def __init__( scope: Optional[str] = None, status: Optional[Union[str, "_models.ScheduledActionStatus"]] = None, view_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :paramtype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4811,7 +4947,7 @@ class ScheduledActionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -4870,8 +5006,8 @@ def __init__( days_of_week: Optional[List[Union[str, "_models.DaysOfWeek"]]] = None, weeks_of_month: Optional[List[Union[str, "_models.WeeksOfMonth"]]] = None, day_of_month: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword frequency: Frequency of the schedule. Required. Known values are: "Daily", "Weekly", and "Monthly". @@ -4985,8 +5121,8 @@ def __init__( term: Optional[Union[str, "_models.Term"]] = None, commitment_granularity: Optional[Union[str, "_models.Grain"]] = None, recommendation_details: Optional["_models.AllSavingsBenefitDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword look_back_period: The number of days of usage evaluated for computing the recommendations. Known values are: "Last7Days", "Last30Days", and "Last60Days". @@ -5011,7 +5147,7 @@ def __init__( recommendation_details=recommendation_details, **kwargs ) - self.scope = "Shared" # type: str + self.scope: str = "Shared" class SingleScopeBenefitRecommendationProperties( @@ -5106,8 +5242,8 @@ def __init__( term: Optional[Union[str, "_models.Term"]] = None, commitment_granularity: Optional[Union[str, "_models.Grain"]] = None, recommendation_details: Optional["_models.AllSavingsBenefitDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword look_back_period: The number of days of usage evaluated for computing the recommendations. Known values are: "Last7Days", "Last30Days", and "Last60Days". @@ -5132,7 +5268,7 @@ def __init__( recommendation_details=recommendation_details, **kwargs ) - self.scope = "Single" # type: str + self.scope: str = "Single" self.subscription_id = None self.resource_group = None @@ -5149,7 +5285,9 @@ class Status(_serialization.Model): "status": {"key": "status", "type": "str"}, } - def __init__(self, *, status: Optional[Union[str, "_models.ReportOperationStatusType"]] = None, **kwargs): + def __init__( + self, *, status: Optional[Union[str, "_models.ReportOperationStatusType"]] = None, **kwargs: Any + ) -> None: """ :keyword status: The status of the long running operation. Known values are: "InProgress", "Completed", "Failed", "Queued", "NoDataFound", "ReadyToDownload", and "TimedOut". @@ -5196,8 +5334,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -5342,8 +5480,8 @@ def __init__( time_period: Optional["_models.ReportConfigTimePeriod"] = None, data_set: Optional["_models.ReportConfigDataset"] = None, include_monetary_commitment: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -5435,7 +5573,7 @@ class ViewListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py index 2d305a7dc351..ba3f6355c103 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py @@ -28,7 +28,7 @@ from ._benefit_utilization_summaries_operations import BenefitUtilizationSummariesOperations 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/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py index 39878262b5b6..ccde2d8e4636 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_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_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +47,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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") @@ -67,7 +62,7 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +72,7 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _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,8 +87,8 @@ def build_dismiss_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-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_dismiss_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReque "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _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,7 +119,7 @@ def build_list_external_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +134,7 @@ def build_list_external_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_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") @@ -173,6 +168,9 @@ def __init__(self, *args, **kwargs): def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: """Lists the alerts for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -206,10 +204,8 @@ def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -219,10 +215,11 @@ def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: 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 @@ -239,12 +236,15 @@ def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} @distributed_trace def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: """Gets the alert for the scope by alert ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -280,10 +280,8 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -294,10 +292,11 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: 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 @@ -314,7 +313,7 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @overload def dismiss( @@ -328,6 +327,9 @@ def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -364,6 +366,9 @@ def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -400,6 +405,9 @@ def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -419,8 +427,8 @@ def dismiss( :type scope: str :param alert_id: Alert ID. Required. :type alert_id: str - :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a + DismissAlertPayload type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.DismissAlertPayload or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -441,11 +449,9 @@ def dismiss( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -467,10 +473,11 @@ def dismiss( 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 @@ -487,7 +494,7 @@ def dismiss( return deserialized - dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @distributed_trace def list_external( @@ -498,6 +505,9 @@ def list_external( ) -> _models.AlertsResult: """Lists the Alerts for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -524,10 +534,8 @@ def list_external( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_external_request( external_cloud_provider_type=external_cloud_provider_type, @@ -538,10 +546,11 @@ def list_external( 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 @@ -558,4 +567,6 @@ def list_external( return deserialized - list_external.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts"} # type: ignore + list_external.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_operations.py index 62e7f41d301a..3503a1d3721e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_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 import urllib.parse @@ -30,10 +29,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_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_request( "billingScope": _SERIALIZER.url("billing_scope", billing_scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -108,6 +103,9 @@ def list( ) -> Iterable["_models.BenefitRecommendationModel"]: """List of recommendations for purchasing savings plan. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/CostManagement/ + :param billing_scope: The scope associated with benefit recommendation operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, @@ -139,10 +137,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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitRecommendationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitRecommendationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -166,7 +162,7 @@ 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: # make call to next link with the client's api-version @@ -182,7 +178,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -190,14 +186,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitRecommendationsListResult", 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 @@ -210,4 +207,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} # type: ignore + list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_operations.py index 4045f0f98ee4..3a8af9d96867 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_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, Union import urllib.parse @@ -30,10 +29,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_account_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,7 @@ def build_list_by_billing_account_id_request( "billingAccountId": _SERIALIZER.url("billing_account_id", billing_account_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") @@ -89,7 +84,7 @@ def build_list_by_billing_profile_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +97,7 @@ def build_list_by_billing_profile_id_request( "billingProfileId": _SERIALIZER.url("billing_profile_id", billing_profile_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") @@ -127,7 +122,7 @@ def build_list_by_savings_plan_order_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +134,7 @@ def build_list_by_savings_plan_order_request( "savingsPlanOrderId": _SERIALIZER.url("savings_plan_order_id", savings_plan_order_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") @@ -165,7 +160,7 @@ def build_list_by_savings_plan_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +173,7 @@ def build_list_by_savings_plan_id_request( "savingsPlanId": _SERIALIZER.url("savings_plan_id", savings_plan_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") @@ -223,6 +218,9 @@ def list_by_billing_account_id( """Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param grain_parameter: Grain. Known values are: "Hourly", "Daily", and "Monthly". Default @@ -241,10 +239,8 @@ def list_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -267,7 +263,7 @@ 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: # make call to next link with the client's api-version @@ -283,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -291,14 +287,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -311,7 +308,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_billing_profile_id( @@ -325,6 +324,9 @@ def list_by_billing_profile_id( """Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param billing_profile_id: Billing profile ID. Required. @@ -345,10 +347,8 @@ def list_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -372,7 +372,7 @@ 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: # make call to next link with the client's api-version @@ -388,7 +388,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -396,14 +396,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -416,7 +417,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_order( @@ -428,6 +431,9 @@ def list_by_savings_plan_order( ) -> Iterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param filter: Supports filtering by properties/usageDate. Default value is None. @@ -445,10 +451,8 @@ def list_by_savings_plan_order( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -471,7 +475,7 @@ 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: # make call to next link with the client's api-version @@ -487,7 +491,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -495,14 +499,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -515,7 +520,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_savings_plan_order.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_order.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_id( @@ -528,6 +535,9 @@ def list_by_savings_plan_id( ) -> Iterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param savings_plan_id: Savings plan ID. Required. @@ -547,10 +557,8 @@ def list_by_savings_plan_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -574,7 +582,7 @@ 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: # make call to next link with the client's api-version @@ -590,7 +598,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -598,14 +606,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", 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 @@ -618,4 +627,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_savings_plan_id.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_id.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py index 9a94e4e524e3..bf471234ed0b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_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, Union import urllib.parse @@ -30,10 +29,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]] @@ -53,7 +48,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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +57,7 @@ def build_list_request( "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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") @@ -81,7 +76,7 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_by_external_cloud_provider_type_request( +def build_by_external_cloud_provider_type_request( # pylint: disable=name-too-long external_cloud_provider_type: Union[str, _models.ExternalCloudProviderType], external_cloud_provider_id: str, *, @@ -94,7 +89,7 @@ def build_by_external_cloud_provider_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +104,7 @@ def build_by_external_cloud_provider_type_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_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") @@ -159,6 +154,9 @@ def list( ) -> Iterable["_models.Dimension"]: """Lists the dimensions by the defined scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -199,10 +197,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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -227,7 +223,7 @@ 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: # make call to next link with the client's api-version @@ -243,7 +239,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -251,14 +247,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", 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 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 @@ -271,7 +268,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} @distributed_trace def by_external_cloud_provider_type( @@ -286,6 +283,9 @@ def by_external_cloud_provider_type( ) -> Iterable["_models.Dimension"]: """Lists the dimensions by the external cloud provider type. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -319,10 +319,8 @@ def by_external_cloud_provider_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -348,7 +346,7 @@ 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: # make call to next link with the client's api-version @@ -364,7 +362,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -372,14 +370,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", 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 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 @@ -392,4 +391,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions"} # type: ignore + by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py index 958ac4bdb38d..e3439e203dad 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_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_list_request(scope: str, *, expand: Optional[str] = None, **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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +47,7 @@ def build_list_request(scope: str, *, expand: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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,7 +64,7 @@ def build_get_request(scope: str, export_name: str, *, expand: Optional[str] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +74,7 @@ def build_get_request(scope: str, export_name: str, *, expand: Optional[str] = N "exportName": _SERIALIZER.url("export_name", export_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") @@ -96,8 +91,8 @@ def build_create_or_update_request(scope: str, export_name: str, **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", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +102,7 @@ def build_create_or_update_request(scope: str, export_name: str, **kwargs: Any) "exportName": _SERIALIZER.url("export_name", export_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,7 +119,7 @@ def build_delete_request(scope: str, export_name: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +129,7 @@ def build_delete_request(scope: str, export_name: str, **kwargs: Any) -> HttpReq "exportName": _SERIALIZER.url("export_name", export_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") @@ -149,7 +144,7 @@ def build_execute_request(scope: str, export_name: str, **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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +154,7 @@ def build_execute_request(scope: str, export_name: str, **kwargs: Any) -> HttpRe "exportName": _SERIALIZER.url("export_name", export_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") @@ -174,7 +169,7 @@ def build_get_execution_history_request(scope: str, export_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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +179,7 @@ def build_get_execution_history_request(scope: str, export_name: str, **kwargs: "exportName": _SERIALIZER.url("export_name", export_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") @@ -218,6 +213,9 @@ def __init__(self, *args, **kwargs): def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _models.ExportListResult: """The operation to list all exports at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -255,10 +253,8 @@ def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportListResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -269,10 +265,11 @@ def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _mode 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 @@ -289,12 +286,15 @@ def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _mode return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} @distributed_trace def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwargs: Any) -> _models.Export: """The operation to get the export for the defined scope by export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -334,10 +334,8 @@ def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -349,10 +347,11 @@ def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwar 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 @@ -369,7 +368,7 @@ def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwar return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @overload def create_or_update( @@ -385,6 +384,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -423,6 +425,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -461,6 +466,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -481,7 +489,7 @@ def create_or_update( :param export_name: Export Name. Required. :type export_name: str :param parameters: Parameters supplied to the CreateOrUpdate Export operation. Is either a - model type or a IO type. Required. + Export type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.Export or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -502,11 +510,9 @@ def 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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -528,10 +534,11 @@ def create_or_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 @@ -548,11 +555,11 @@ def create_or_update( deserialized = self._deserialize("Export", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -560,6 +567,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -595,10 +605,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -609,10 +617,11 @@ def delete( # pylint: disable=inconsistent-return-statements 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 @@ -625,7 +634,7 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace def execute( # pylint: disable=inconsistent-return-statements @@ -633,6 +642,9 @@ def execute( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to run an export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -668,10 +680,8 @@ def execute( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( scope=scope, @@ -682,10 +692,11 @@ def execute( # pylint: disable=inconsistent-return-statements 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 @@ -698,12 +709,15 @@ def execute( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} # type: ignore + execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} @distributed_trace def get_execution_history(self, scope: str, export_name: str, **kwargs: Any) -> _models.ExportExecutionListResult: """The operation to get the run history of an export for the defined scope and export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -739,10 +753,8 @@ def get_execution_history(self, scope: str, export_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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportExecutionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportExecutionListResult] = kwargs.pop("cls", None) request = build_get_execution_history_request( scope=scope, @@ -753,10 +765,11 @@ def get_execution_history(self, scope: str, export_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 @@ -773,4 +786,6 @@ def get_execution_history(self, scope: str, export_name: str, **kwargs: Any) -> return deserialized - get_execution_history.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory"} # type: ignore + get_execution_history.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py index 87053c2968cf..adf5dfb5f756 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_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,8 +38,8 @@ def build_usage_request(scope: str, *, filter: Optional[str] = None, **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", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +48,7 @@ def build_usage_request(scope: str, *, filter: Optional[str] = None, **kwargs: A "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -68,7 +63,7 @@ def build_usage_request(scope: str, *, filter: Optional[str] = None, **kwargs: A return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_external_cloud_provider_usage_request( +def build_external_cloud_provider_usage_request( # pylint: disable=name-too-long external_cloud_provider_type: Union[str, _models.ExternalCloudProviderType], external_cloud_provider_id: str, *, @@ -78,8 +73,8 @@ def build_external_cloud_provider_usage_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +89,7 @@ def build_external_cloud_provider_usage_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -140,6 +135,9 @@ def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -185,6 +183,9 @@ def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -224,6 +225,9 @@ def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -242,7 +246,7 @@ def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -267,11 +271,9 @@ def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ForecastResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ForecastResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -293,10 +295,11 @@ def usage( 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 @@ -315,7 +318,7 @@ def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} @overload def external_cloud_provider_usage( @@ -330,6 +333,9 @@ def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -369,6 +375,9 @@ def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -406,6 +415,9 @@ def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -417,7 +429,7 @@ def external_cloud_provider_usage( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -442,11 +454,9 @@ def external_cloud_provider_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ForecastResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ForecastResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -469,10 +479,11 @@ def external_cloud_provider_usage( 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 @@ -489,4 +500,6 @@ def external_cloud_provider_usage( return deserialized - external_cloud_provider_usage.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast"} # type: ignore + external_cloud_provider_usage.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_operations.py index abb85608f83d..e98e54ea23c4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_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, cast, overload from azure.core.exceptions import ( @@ -30,10 +29,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,8 +40,8 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +50,7 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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_get_operation_results_request(scope: str, operation_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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +79,7 @@ def build_get_operation_results_request(scope: str, operation_id: str, **kwargs: "operationId": _SERIALIZER.url("operation_id", operation_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") @@ -128,11 +123,9 @@ def _create_operation_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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -153,15 +146,16 @@ def _create_operation_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 - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.GenerateCostDetailsReportErrorResponse, pipeline_response @@ -182,7 +176,9 @@ def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport" + } @overload def begin_create_operation( @@ -202,7 +198,12 @@ def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -240,7 +241,12 @@ def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -278,13 +284,18 @@ def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str - :param parameters: Parameters supplied to the Create cost details operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to the Create cost details operation. Is either a + GenerateCostDetailsReportRequestDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateCostDetailsReportRequestDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -307,16 +318,14 @@ def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CostDetailsOperationResults] = 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_operation_initial( # type: ignore + raw_result = self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -335,9 +344,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: @@ -349,9 +358,9 @@ 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_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} def _get_operation_results_initial( self, scope: str, operation_id: str, **kwargs: Any @@ -367,10 +376,8 @@ def _get_operation_results_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) request = build_get_operation_results_request( scope=scope, @@ -381,10 +388,11 @@ def _get_operation_results_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 @@ -403,7 +411,9 @@ def _get_operation_results_initial( return deserialized - _get_operation_results_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + _get_operation_results_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } @distributed_trace def begin_get_operation_results( @@ -434,15 +444,13 @@ def begin_get_operation_results( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CostDetailsOperationResults] = 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._get_operation_results_initial( # type: ignore + raw_result = self._get_operation_results_initial( scope=scope, operation_id=operation_id, api_version=api_version, @@ -460,9 +468,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: @@ -474,6 +482,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_get_operation_results.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + begin_get_operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py index 0cc2d0a6b70c..fe9816fc945f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_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, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,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_request(operation_id: str, scope: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +50,7 @@ def build_get_request(operation_id: str, scope: str, **kwargs: Any) -> HttpReque "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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") @@ -99,10 +94,8 @@ def _get_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -113,10 +106,11 @@ def _get_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 @@ -135,7 +129,7 @@ def _get_initial( return deserialized - _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} @distributed_trace def begin_get( @@ -166,15 +160,13 @@ def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = 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._get_initial( # type: ignore + raw_result = self._get_initial( operation_id=operation_id, scope=scope, api_version=api_version, @@ -192,7 +184,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: @@ -204,6 +196,6 @@ 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_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + begin_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py index 9e9300779dc7..35352c896734 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_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(operation_id: str, scope: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +48,7 @@ def build_get_request(operation_id: str, scope: str, **kwargs: Any) -> HttpReque "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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,10 +104,8 @@ def get(self, operation_id: str, scope: str, **kwargs: Any) -> _models.GenerateD _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationStatuses] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationStatuses] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -123,10 +116,11 @@ def get(self, operation_id: str, scope: str, **kwargs: Any) -> _models.GenerateD 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 @@ -143,4 +137,4 @@ def get(self, operation_id: str, scope: str, **kwargs: Any) -> _models.GenerateD return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py index d1aa61e8aef0..e120ec071211 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_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, cast, overload from azure.core.exceptions import ( @@ -30,10 +29,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,8 +40,8 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +50,7 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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") @@ -101,11 +96,9 @@ def _create_operation_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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -126,10 +119,11 @@ def _create_operation_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 @@ -161,7 +155,9 @@ def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport" + } @overload def begin_create_operation( @@ -178,6 +174,9 @@ def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -211,6 +210,9 @@ def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -244,11 +246,14 @@ def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str :param parameters: Parameters supplied to the Create detailed cost report operation. Is either - a model type or a IO type. Required. + a GenerateDetailedCostReportDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -270,16 +275,14 @@ def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = 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_operation_initial( # type: ignore + raw_result = self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -298,9 +301,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: @@ -312,6 +315,6 @@ 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_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py index fe00d3275649..acfd66c3eca0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_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, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,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]] @@ -47,7 +42,7 @@ def build_by_billing_account_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_by_billing_account_id_request( "billingAccountId": _SERIALIZER.url("billing_account_id", billing_account_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["startDate"] = _SERIALIZER.query("start_date", start_date, "str") @@ -78,7 +73,7 @@ def build_by_billing_profile_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +86,7 @@ def build_by_billing_profile_id_request( "billingProfileId": _SERIALIZER.url("billing_profile_id", billing_profile_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["startDate"] = _SERIALIZER.query("start_date", start_date, "str") @@ -137,10 +132,8 @@ def _by_billing_account_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_account_id_request( billing_account_id=billing_account_id, @@ -152,10 +145,11 @@ def _by_billing_account_id_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 @@ -179,7 +173,9 @@ def _by_billing_account_id_initial( return deserialized - _by_billing_account_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_account_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace def begin_by_billing_account_id( @@ -188,7 +184,10 @@ def begin_by_billing_account_id( """Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, - https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + https://docs.microsoft.com/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). Required. :type billing_account_id: str @@ -212,15 +211,13 @@ def begin_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = 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._by_billing_account_id_initial( # type: ignore + raw_result = self._by_billing_account_id_initial( billing_account_id=billing_account_id, start_date=start_date, end_date=end_date, @@ -239,9 +236,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: @@ -253,9 +250,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_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } def _by_billing_profile_id_initial( self, billing_account_id: str, billing_profile_id: str, start_date: str, end_date: str, **kwargs: Any @@ -271,10 +270,8 @@ def _by_billing_profile_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_profile_id_request( billing_account_id=billing_account_id, @@ -287,10 +284,11 @@ def _by_billing_profile_id_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 @@ -314,7 +312,9 @@ def _by_billing_profile_id_initial( return deserialized - _by_billing_profile_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_profile_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace def begin_by_billing_profile_id( @@ -323,7 +323,10 @@ def begin_by_billing_profile_id( """Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, - https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + https://docs.microsoft.com/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param billing_account_id: Billing account ID. Required. :type billing_account_id: str @@ -349,15 +352,13 @@ def begin_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = 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._by_billing_profile_id_initial( # type: ignore + raw_result = self._by_billing_profile_id_initial( billing_account_id=billing_account_id, billing_profile_id=billing_profile_id, start_date=start_date, @@ -377,9 +378,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: @@ -391,6 +392,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_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py index 35d797e55af8..d227fb63fadc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/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 import urllib.parse @@ -30,10 +29,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]] @@ -45,7 +40,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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,10 +87,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.CostManagementOperation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +108,7 @@ 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: # make call to next link with the client's api-version @@ -131,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -139,14 +132,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 @@ -159,4 +153,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_operations.py index e283527e8af8..c4aaf9989c31 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_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, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,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]] @@ -47,7 +42,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +63,7 @@ def build_download_request( "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str", pattern=r"[A-Za-z0-9]+"), } - _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") @@ -79,13 +74,13 @@ def build_download_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_download_by_billing_profile_request( +def build_download_by_billing_profile_request( # pylint: disable=name-too-long billing_account_name: str, billing_profile_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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +100,7 @@ def build_download_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") @@ -149,10 +144,8 @@ def _download_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_request( billing_account_name=billing_account_name, @@ -164,10 +157,11 @@ def _download_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 @@ -192,7 +186,9 @@ def _download_initial( return deserialized - _download_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace def begin_download( @@ -223,15 +219,13 @@ def begin_download( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-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", self._config.api_version)) + 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_initial( # type: ignore + raw_result = self._download_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, invoice_name=invoice_name, @@ -250,9 +244,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: @@ -264,9 +258,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.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } def _download_by_billing_profile_initial( self, billing_account_name: str, billing_profile_name: str, **kwargs: Any @@ -282,10 +278,8 @@ def _download_by_billing_profile_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_by_billing_profile_request( billing_account_name=billing_account_name, @@ -296,10 +290,11 @@ def _download_by_billing_profile_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 @@ -324,7 +319,9 @@ def _download_by_billing_profile_initial( return deserialized - _download_by_billing_profile_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_by_billing_profile_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace def begin_download_by_billing_profile( @@ -356,15 +353,13 @@ def begin_download_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", self._config.api_version) - ) # type: Literal["2022-10-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", self._config.api_version)) + 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_by_billing_profile_initial( # type: ignore + raw_result = self._download_by_billing_profile_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, api_version=api_version, @@ -382,9 +377,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: @@ -396,6 +391,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_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py index 0941b5681a4a..0aaf01e5cfff 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_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,8 +38,8 @@ def build_usage_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +48,7 @@ def build_usage_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _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") @@ -66,7 +61,7 @@ def build_usage_request(scope: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_usage_by_external_cloud_provider_type_request( +def build_usage_by_external_cloud_provider_type_request( # pylint: disable=name-too-long external_cloud_provider_type: Union[str, _models.ExternalCloudProviderType], external_cloud_provider_id: str, **kwargs: Any @@ -74,8 +69,8 @@ def build_usage_by_external_cloud_provider_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +85,7 @@ def build_usage_by_external_cloud_provider_type_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_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") @@ -128,6 +123,9 @@ def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -162,6 +160,9 @@ def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -196,6 +197,9 @@ def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -214,7 +218,7 @@ def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -235,11 +239,9 @@ def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.QueryResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.QueryResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -260,10 +262,11 @@ def usage( 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 @@ -282,7 +285,7 @@ def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} @overload def usage_by_external_cloud_provider_type( @@ -296,6 +299,9 @@ def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -329,6 +335,9 @@ def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -360,6 +369,9 @@ def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -371,7 +383,7 @@ def usage_by_external_cloud_provider_type( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -392,11 +404,9 @@ def usage_by_external_cloud_provider_type( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueryResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -418,10 +428,11 @@ def usage_by_external_cloud_provider_type( 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 @@ -438,4 +449,6 @@ def usage_by_external_cloud_provider_type( return deserialized - usage_by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query"} # type: ignore + usage_by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_operations.py index 4287dbd5a343..a501f34d5459 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_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 import urllib.parse @@ -30,10 +29,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_list_request(*, filter: 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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +61,7 @@ def build_list_by_scope_request(scope: str, *, filter: Optional[str] = None, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +70,7 @@ def build_list_by_scope_request(scope: str, *, filter: Optional[str] = None, **k "scope": _SERIALIZER.url("scope", scope, "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") @@ -88,12 +83,12 @@ def build_list_by_scope_request(scope: str, *, filter: Optional[str] = None, **k return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request(name: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request(name: str, *, if_match: Optional[str] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,12 +97,14 @@ def build_create_or_update_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") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -119,7 +116,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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +125,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") @@ -143,7 +140,7 @@ def build_delete_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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +149,7 @@ def build_delete_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") @@ -163,12 +160,14 @@ def build_delete_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_by_scope_request( + scope: str, name: str, *, if_match: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,12 +177,14 @@ def build_create_or_update_by_scope_request(scope: str, name: str, **kwargs: Any "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") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -195,7 +196,7 @@ def build_get_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +206,7 @@ def build_get_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ "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") @@ -220,7 +221,7 @@ def build_delete_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +231,7 @@ def build_delete_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpR "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") @@ -245,7 +246,7 @@ def build_run_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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +255,7 @@ def build_run_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") @@ -269,7 +270,7 @@ def build_run_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +280,7 @@ def build_run_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ "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") @@ -294,8 +295,8 @@ def build_check_name_availability_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,12 +313,14 @@ def build_check_name_availability_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_by_scope_request(scope: str, **kwargs: Any) -> HttpRequest: +def build_check_name_availability_by_scope_request( # pylint: disable=name-too-long + scope: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -326,7 +329,7 @@ def build_check_name_availability_by_scope_request(scope: str, **kwargs: Any) -> "scope": _SERIALIZER.url("scope", scope, "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 +365,9 @@ def __init__(self, *args, **kwargs): def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ScheduledAction"]: """List all private scheduled actions. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param filter: May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. Default value is None. :type filter: str @@ -373,10 +379,8 @@ def list(self, filter: 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", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -397,7 +401,7 @@ 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: # make call to next link with the client's api-version @@ -413,7 +417,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -421,27 +425,30 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} @distributed_trace def list_by_scope( @@ -449,6 +456,9 @@ def list_by_scope( ) -> Iterable["_models.ScheduledAction"]: """List all shared scheduled actions within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -478,10 +488,8 @@ def list_by_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -503,7 +511,7 @@ 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: # make call to next link with the client's api-version @@ -519,7 +527,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -527,33 +535,37 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} @overload def create_or_update( self, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -564,6 +576,10 @@ def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -575,7 +591,13 @@ def create_or_update( @overload def create_or_update( - self, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. @@ -583,6 +605,10 @@ def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -594,15 +620,23 @@ def create_or_update( @distributed_trace def create_or_update( - self, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -622,11 +656,9 @@ def 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", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -638,6 +670,7 @@ def create_or_update( request = build_create_or_update_request( name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -647,17 +680,18 @@ def create_or_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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -667,16 +701,19 @@ def create_or_update( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the private scheduled action by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -695,10 +732,8 @@ def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_request( name=name, @@ -708,17 +743,18 @@ def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -728,12 +764,15 @@ def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Delete a private scheduled action. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -752,10 +791,8 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( name=name, @@ -765,23 +802,24 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist 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 if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @overload def create_or_update_by_scope( @@ -789,6 +827,7 @@ def create_or_update_by_scope( scope: str, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -817,6 +856,10 @@ def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -828,7 +871,14 @@ def create_or_update_by_scope( @overload def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -854,6 +904,10 @@ def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -865,7 +919,12 @@ def create_or_update_by_scope( @distributed_trace def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -889,9 +948,13 @@ def create_or_update_by_scope( :type scope: str :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -911,11 +974,9 @@ def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -928,6 +989,7 @@ def create_or_update_by_scope( request = build_create_or_update_by_scope_request( scope=scope, name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -937,17 +999,18 @@ def create_or_update_by_scope( 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 if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -957,16 +1020,19 @@ def create_or_update_by_scope( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the shared scheduled action from the given scope by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -1003,10 +1069,8 @@ def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Schedule _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -1017,17 +1081,18 @@ def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Schedule 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -1037,7 +1102,7 @@ def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Schedule return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -1045,6 +1110,9 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a scheduled action within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -1081,10 +1149,8 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -1095,23 +1161,24 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements 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 if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -1135,10 +1202,8 @@ def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_request( name=name, @@ -1148,23 +1213,24 @@ def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @distributed_trace def run_by_scope( # pylint: disable=inconsistent-return-statements @@ -1208,10 +1274,8 @@ def run_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_by_scope_request( scope=scope, @@ -1222,23 +1286,24 @@ def run_by_scope( # pylint: disable=inconsistent-return-statements 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @overload def check_name_availability( @@ -1286,7 +1351,7 @@ def check_name_availability( """Checks availability and correctness of the name for a scheduled action. :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1308,11 +1373,9 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1332,17 +1395,18 @@ def check_name_availability( 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1352,7 +1416,7 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} @overload def check_name_availability_by_scope( @@ -1458,7 +1522,7 @@ def check_name_availability_by_scope( Required. :type scope: str :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1480,11 +1544,9 @@ def check_name_availability_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1505,17 +1567,18 @@ def check_name_availability_by_scope( 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1525,4 +1588,6 @@ def check_name_availability_by_scope( return deserialized - check_name_availability_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability_by_scope.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py index 598e85f13489..5a8c6fdc4ff2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_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 import urllib.parse @@ -30,10 +29,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_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,7 @@ def build_list_by_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +68,7 @@ def build_list_by_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "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") @@ -88,7 +83,7 @@ def build_get_request(view_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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +92,7 @@ def build_get_request(view_name: str, **kwargs: Any) -> HttpRequest: "viewName": _SERIALIZER.url("view_name", view_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") @@ -112,8 +107,8 @@ def build_create_or_update_request(view_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", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-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(view_name: str, **kwargs: Any) -> HttpRequest "viewName": _SERIALIZER.url("view_name", view_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_delete_request(view_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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +143,7 @@ def build_delete_request(view_name: str, **kwargs: Any) -> HttpRequest: "viewName": _SERIALIZER.url("view_name", view_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,7 +158,7 @@ def build_get_by_scope_request(scope: str, view_name: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +168,7 @@ def build_get_by_scope_request(scope: str, view_name: str, **kwargs: Any) -> Htt "viewName": _SERIALIZER.url("view_name", view_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") @@ -188,8 +183,8 @@ def build_create_or_update_by_scope_request(scope: str, view_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", "2022-10-01")) # type: Literal["2022-10-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", "2022-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +194,7 @@ def build_create_or_update_by_scope_request(scope: str, view_name: str, **kwargs "viewName": _SERIALIZER.url("view_name", view_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") @@ -216,7 +211,7 @@ def build_delete_by_scope_request(scope: str, view_name: str, **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", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -226,7 +221,7 @@ def build_delete_by_scope_request(scope: str, view_name: str, **kwargs: Any) -> "viewName": _SERIALIZER.url("view_name", view_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") @@ -260,6 +255,9 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.View"]: """Lists all views by tenant and object. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either View or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.View] @@ -268,10 +266,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.View"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -291,7 +287,7 @@ 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: # make call to next link with the client's api-version @@ -307,7 +303,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 @@ -315,14 +311,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", 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 @@ -335,12 +332,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} @distributed_trace def list_by_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.View"]: """Lists all views at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -367,10 +367,8 @@ def list_by_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.View"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -391,7 +389,7 @@ 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: # make call to next link with the client's api-version @@ -407,7 +405,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) 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 +413,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", 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,12 +434,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} @distributed_trace def get(self, view_name: str, **kwargs: Any) -> _models.View: """Gets the view by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -459,10 +461,8 @@ def get(self, view_name: str, **kwargs: Any) -> _models.View: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_request( view_name=view_name, @@ -472,10 +472,11 @@ def get(self, view_name: str, **kwargs: Any) -> _models.View: 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 @@ -492,7 +493,7 @@ def get(self, view_name: str, **kwargs: Any) -> _models.View: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @overload def create_or_update( @@ -502,6 +503,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -523,6 +527,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -542,9 +549,12 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -566,11 +576,9 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -591,10 +599,11 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], 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 @@ -611,16 +620,19 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -639,10 +651,8 @@ def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( view_name=view_name, @@ -652,10 +662,11 @@ def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inco 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 @@ -668,12 +679,15 @@ def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.View: """Gets the view for the defined scope by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -710,10 +724,8 @@ def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.Vie _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -724,10 +736,11 @@ def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.Vie 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 @@ -744,7 +757,7 @@ def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.Vie return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @overload def create_or_update_by_scope( @@ -760,6 +773,9 @@ def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -799,6 +815,9 @@ def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -838,6 +857,9 @@ def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -858,7 +880,7 @@ def create_or_update_by_scope( :type scope: str :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -880,11 +902,9 @@ def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -906,10 +926,11 @@ def create_or_update_by_scope( 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 @@ -926,11 +947,11 @@ def create_or_update_by_scope( deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -938,6 +959,9 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -974,10 +998,8 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -988,10 +1010,11 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements 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 @@ -1004,4 +1027,4 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_billing_account_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_by_billing_account.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_billing_account_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_by_billing_account.py index 625abc9640d1..92332e0a8bf2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_billing_account_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_by_billing_account.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python benefit_recommendations_billing_account_list.py + python benefit_recommendations_by_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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list.py index 9b783373c3ff..f0e45e39ad6c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_legacy.py + python billing_account_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top.py index f13c043cc3ab..874fc420c63d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_expand_and_top_legacy.py + python billing_account_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter.py index 67b139a555d6..02bd4d716cc0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_with_filter_legacy.py + python billing_account_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query.py index 52ab82ffe603..a7cae2acc067 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_legacy.py + python billing_account_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping.py index fbc06c135d76..13b762d01fcf 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_grouping_legacy.py + python billing_account_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/check_name_availabilityprivatescheduled_action.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/check_name_availabilityprivatescheduled_action.py index 8b9234d05831..3fe817df9a29 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/check_name_availabilityprivatescheduled_action.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_check_name_availability.py + python check_name_availabilityprivatescheduled_action.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/check_name_availabilitysharedscheduled_action.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/check_name_availabilitysharedscheduled_action.py index b4143d3fec08..3527687cfd09 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/check_name_availabilitysharedscheduled_action.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_check_name_availability_by_scope.py + python check_name_availabilitysharedscheduled_action.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/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_result.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/cost_details_operation_results_by_subscription_scope.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_result.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/cost_details_operation_results_by_subscription_scope.py index ae8aff59026d..5c2a8daab65e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_result.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/cost_details_operation_results_by_subscription_scope.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python get_details_of_the_operation_result.py + python cost_details_operation_results_by_subscription_scope.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/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list.py index 8e4903cf4ade..a38421094702 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_dimensions_list_legacy.py + python department_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top.py index 5e642afe4c34..48935633c8ac 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_dimensions_list_expand_and_top_legacy.py + python department_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter.py index 006cc534aea9..23e65cb1cb0c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_dimensions_list_with_filter_legacy.py + python department_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query.py index 90e9f5d78123..f31157b94afd 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_query_legacy.py + python department_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping.py index 749034add892..36c7d45875f4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_query_grouping_legacy.py + python department_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_resource_group_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_resource_group_alerts.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_resource_group_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_resource_group_alerts.py index 2ac6755fa379..face8893712c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_resource_group_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_resource_group_alerts.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python patch_resource_group_alerts.py + python dismiss_resource_group_alerts.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/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_subscription_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_subscription_alerts.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_subscription_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_subscription_alerts.py index f9c4741ea35b..2da152c2d778 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_subscription_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_subscription_alerts.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python patch_subscription_alerts.py + python dismiss_subscription_alerts.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/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list.py index a1e0f832dd55..e58b8e1c6003 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_dimensions_list_legacy.py + python enrollment_account_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top.py index 9f185bbf54ea..d730beedb0a2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_dimensions_list_expand_and_top_legacy.py + python enrollment_account_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter.py index 0f8601ded405..aa4098802237 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_dimensions_list_with_filter_legacy.py + python enrollment_account_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query.py index a050b8d77006..b62acd0963eb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_query_legacy.py + python enrollment_account_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping.py index 1a9a0f056274..4a49084d6642 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_query_grouping_legacy.py + python enrollment_account_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_dimension_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_dimensions.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_dimension_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_dimensions.py index cfd8376e447b..b764fdd3c0ed 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_dimension_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_dimensions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python external_billing_account_dimension_list.py + python external_billing_accounts_dimensions.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/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_query_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_query_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_query.py index dd9b1d56b757..69b7503274a8 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_query_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python external_billing_account_query_list.py + python external_billing_accounts_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_dimension_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_dimensions.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_dimension_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_dimensions.py index 82f50d54bc88..ff8ef5e75164 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_dimension_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_dimensions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python external_subscription_dimension_list.py + python external_subscriptions_dimensions.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/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_results_by_subscription_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_results_by_subscription_scope.py new file mode 100644 index 000000000000..ad52d818c68e --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_results_by_subscription_scope.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.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_detailed_cost_report_operation_results_by_subscription_scope.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 = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.generate_detailed_cost_report_operation_results.begin_get( + operation_id="00000000-0000-0000-0000-000000000000", + scope="subscriptions/00000000-0000-0000-0000-000000000000", + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_status.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_status_by_subscription_scope.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_status.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_status_by_subscription_scope.py index 34a7e2786535..faf3c338f455 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_status.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_status_by_subscription_scope.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python get_details_of_the_operation_status.py + python generate_detailed_cost_report_operation_status_by_subscription_scope.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/costmanagement/azure-mgmt-costmanagement/generated_samples/reservation_details.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_account.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/reservation_details.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_account.py index 8fe21d7aa2b8..5cbf1f685c89 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/reservation_details.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_account.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python reservation_details.py + python generate_reservation_details_report_by_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/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_profile.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_profile.py new file mode 100644 index 000000000000..29acfba80850 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_profile.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.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_reservation_details_report_by_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, + 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 = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.generate_reservation_details_report.begin_by_billing_profile_id( + billing_account_id="00000000-0000-0000-0000-000000000000", + billing_profile_id="CZSFR-SDFXC-DSDF", + start_date="2020-01-01", + end_date="2020-01-30", + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list.py index df07d8a00487..a57a6252f33b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_dimensions_list_legacy.py + python management_group_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top.py index 63ffe448c71a..fd618f059528 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_dimensions_list_expand_and_top_legacy.py + python management_group_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter.py index 1ce215fa7568..d6624fb9d858 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_dimensions_list_with_filter_legacy.py + python management_group_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query.py index 28fc66ee84cb..259ead41ae0e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_query_legacy.py + python management_group_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping.py index c2d9318c5f2a..fda6bddcc595 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_query_grouping_legacy.py + python management_group_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list.py index 4a909d49f2c4..9f7cba047e65 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_mca.py + python mca_billing_account_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_expand_and_top.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_expand_and_top.py index b36c0023b616..659323eb7296 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_expand_and_top_mca.py + python mca_billing_account_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_with_filter.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_with_filter.py index 18aa8a51e66e..0f16db5f30bb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_with_filter_mca.py + python mca_billing_account_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query.py index 0906ec936fdf..7c8456bba766 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_mca.py + python mca_billing_account_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query_grouping.py index bf0c9c6ebcdc..3e3dffe50f13 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_grouping_mca.py + python mca_billing_account_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list.py index b4551d052232..f4b4e44b51d1 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_dimensions_list_mca.py + python mca_billing_profile_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_expand_and_top.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_expand_and_top.py index e28d1ab0f174..801c2ef43317 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_dimensions_list_expand_and_top_mca.py + python mca_billing_profile_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_with_filter.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_with_filter.py index 26cf5ef67fa2..ed2286ccfe72 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_dimensions_list_with_filter_mca.py + python mca_billing_profile_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query.py index 57d7ec2310fa..bd56472dcdbb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_query_mca.py + python mca_billing_profile_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query_grouping.py index 82459da672fb..cacb2c21e4d5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_query_grouping_mca.py + python mca_billing_profile_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list.py index 473ceb5317fe..16ca7b1798a2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_dimensions_list_mca.py + python mca_customer_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_expand_and_top.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_expand_and_top.py index 0b9df1f03006..b941fb680e48 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_dimensions_list_expand_and_top_mca.py + python mca_customer_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_with_filter.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_with_filter.py index a3904170e9fa..498fb66387df 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_dimensions_list_with_filter_mca.py + python mca_customer_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query.py index d747fd1fd25b..4dcb6efde3d4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_query_mca.py + python mca_customer_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query_grouping.py index 370c57b3598f..c4c0ff727c0a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_query_grouping_mca.py + python mca_customer_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list.py index c4a07725f82c..11b68a17f4d4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_dimensions_list_mca.py + python mca_invoice_section_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_expand_and_top.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_expand_and_top.py index e05d46b14db1..e449f04d320c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_dimensions_list_expand_and_top_mca.py + python mca_invoice_section_dimensions_list_expand_and_top.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/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_with_filter.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_with_filter.py index 4b31258e0748..14b352dfb098 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_dimensions_list_with_filter_mca.py + python mca_invoice_section_dimensions_list_with_filter.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/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query.py index 2806276c3bc4..7a472df6af05 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_query_mca.py + python mca_invoice_section_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query_grouping.py index 3a2c41c46e53..2030ca2f13a1 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_query_grouping_mca.py + python mca_invoice_section_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_create_or_update.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_create_or_update.py index e09871ae27bc..5b4bfb8a3143 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_create_or_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_private_view.py + python private_view_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/delete_private_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_delete.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/delete_private_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_delete.py index e350deadd5e2..b8691b3f4fb1 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/delete_private_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python delete_private_view.py + python private_view_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list.py index 0751066e2ecd..d8c4c9543dc6 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_dimensions_list_legacy.py + python resource_group_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query.py index 720819019ae1..e4556d516b5f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_query_legacy.py + python resource_group_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping.py index dccb30a3b80b..1d63d0bafb57 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_query_grouping_legacy.py + python resource_group_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_billing_account.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_account.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_billing_account.py index 7c1b071290df..c09892637945 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_billing_account.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_billing_account.py + python savings_plan_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/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_profile.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_billing_profile.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_profile.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_billing_profile.py index ec5ccd3453db..83fd2506ae40 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_profile.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_billing_profile.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_billing_profile.py + python savings_plan_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/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_monthly_with_savings_plan_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_savings_plan_id_monthly.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_monthly_with_savings_plan_id.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_savings_plan_id_monthly.py index 6b75daf0eb01..a3451662d9a5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_monthly_with_savings_plan_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_savings_plan_id_monthly.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_monthly_with_savings_plan_id.py + python savings_plan_savings_plan_id_monthly.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/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_daily.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_savings_plan_order_id_daily.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_daily.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_savings_plan_order_id_daily.py index d925c8e02a7a..6aa7f30f86ef 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_daily.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_savings_plan_order_id_daily.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_daily.py + python savings_plan_savings_plan_order_id_daily.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/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_scheduled_action.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioncreate_or_updateprivate.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_scheduled_action.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioncreate_or_updateprivate.py index bcdc140924c3..eccd776b189f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_scheduled_action.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioncreate_or_updateprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_private_scheduled_action.py + python scheduled_actioncreate_or_updateprivate.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/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_scheduled_action_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioncreate_or_updateshared.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_scheduled_action_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioncreate_or_updateshared.py index 695c27d7ee9e..957b8e9f1f5d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_scheduled_action_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioncreate_or_updateshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_scheduled_action_by_scope.py + python scheduled_actioncreate_or_updateshared.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/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action_delete.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiondeleteprivate.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action_delete.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiondeleteprivate.py index 430d92a77b88..b9968da9988f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action_delete.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiondeleteprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_action_delete.py + python scheduled_actiondeleteprivate.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_delete_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiondeleteshared.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_delete_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiondeleteshared.py index 16475554ac21..e15ae55c9e38 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_delete_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiondeleteshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_delete_by_scope.py + python scheduled_actiondeleteshared.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/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiongetprivate.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiongetprivate.py index b8a398bb6e47..baf04b00199f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiongetprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_action.py + python scheduled_actiongetprivate.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiongetshared.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiongetshared.py index 66e919a9c25c..b21a8394b3cf 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actiongetshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_by_scope.py + python scheduled_actiongetshared.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/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_insight_alert_scheduled_action_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioninsight_alertcreate_or_updateshared.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_insight_alert_scheduled_action_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioninsight_alertcreate_or_updateshared.py index b7ac0ac4ce37..fa047b3903d5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_insight_alert_scheduled_action_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actioninsight_alertcreate_or_updateshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_insight_alert_scheduled_action_by_scope.py + python scheduled_actioninsight_alertcreate_or_updateshared.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_send_now.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionsend_nowprivate.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_send_now.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionsend_nowprivate.py index 74503ffeab06..92eef175aadf 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_send_now.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionsend_nowprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_send_now.py + python scheduled_actionsend_nowprivate.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_run_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionsend_nowshared.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_run_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionsend_nowshared.py index d24de12f2a17..49447cdac074 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_run_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionsend_nowshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_run_by_scope.py + python scheduled_actionsend_nowshared.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/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list_filter_by_view_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslist_with_filterprivate.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list_filter_by_view_id.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslist_with_filterprivate.py index 6814e9ba13ae..229644b5997f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list_filter_by_view_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslist_with_filterprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_actions_list_filter_by_view_id.py + python scheduled_actionslist_with_filterprivate.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope_filter_by_view_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslist_with_filtershared.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope_filter_by_view_id.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslist_with_filtershared.py index 1707a00ae03d..9815805b19a2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope_filter_by_view_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslist_with_filtershared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_actions_list_by_scope_filter_by_view_id.py + python scheduled_actionslist_with_filtershared.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/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslistprivate.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslistprivate.py index efd002ebf1b2..7e1bb07a89f8 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslistprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_actions_list.py + python scheduled_actionslistprivate.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/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslistshared.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslistshared.py index 64d591648bd6..1ce7057cf63c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actionslistshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_actions_list_by_scope.py + python scheduled_actionslistshared.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/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alert.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alert.py index c5e02e62edcc..9d9f5742c791 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alert.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python single_resource_group_alerts.py + python single_resource_group_alert.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/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alert.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alert.py index f3d53894a833..3a504fe6fdb2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alert.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python single_subscription_alerts.py + python single_subscription_alert.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/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list.py index 33c508bb1abc..7c82f57ea2ff 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python subscription_dimensions_list_legacy.py + python subscription_dimensions_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, diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query.py index e3a8e45fdcb5..a80a9cb721c8 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python subscription_query_legacy.py + python subscription_query.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/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping.py index eed3d3246164..90f56b4f701e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python subscription_query_grouping_legacy.py + python subscription_query_grouping.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/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_by_resource_group.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_by_resource_group.py index e9fcfb3a18e2..8ebf3ed7deec 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_view.py + python view_by_resource_group.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/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_create_or_update_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_create_or_update_by_resource_group.py similarity index 98% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_create_or_update_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_create_or_update_by_resource_group.py index ddb41feb5c8f..0c0f6a148b5b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_create_or_update_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_create_or_update_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_create_or_update_view.py + python view_create_or_update_by_resource_group.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/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_delete_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_delete_by_resource_group.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_delete_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_delete_by_resource_group.py index 3e11c6382498..f4c370b8b313 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_delete_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_delete_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_delete_view.py + python view_delete_by_resource_group.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/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_list_by_resource_group.py similarity index 97% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_list_by_resource_group.py index 369b82d349b3..13608bc5eb00 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_list_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_view_list.py + python view_list_by_resource_group.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,