diff --git a/sdk/resources/azure-mgmt-resourcegraph/_meta.json b/sdk/resources/azure-mgmt-resourcegraph/_meta.json index 20906676c5ad..b7bdb7f5a0b2 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/_meta.json +++ b/sdk/resources/azure-mgmt-resourcegraph/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e37a57df67daaa82f9c3758fc450bc8655812a08", + "commit": "d459b0d6dee3fa23850778680cbc81755748e4d1", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.8", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/resourcegraph/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.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/resourcegraph/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/resourcegraph/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py index 95d16f4e4c5c..e4cee1b8d32c 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py @@ -37,7 +37,7 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ResourceGraphClientConfiguration(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)} self._serialize = Serializer(client_models) @@ -74,5 +74,5 @@ def __enter__(self) -> "ResourceGraphClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_serialization.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_serialization.py index 2c170e28dbca..842ae727fbbc 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_serialization.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - 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") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _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__) @@ -287,25 +304,25 @@ 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 # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=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)`. @@ -336,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: @@ -384,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. @@ -396,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 @@ -409,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, @@ -518,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, @@ -534,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 @@ -602,7 +629,7 @@ 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) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,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: @@ -777,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) @@ -1161,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 @@ -1242,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 @@ -1266,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): @@ -1332,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, @@ -1352,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 @@ -1471,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 @@ -1486,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, @@ -1496,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: diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_version.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_version.py index ab954b3972b4..c47f66669f1b 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_version.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "8.1.0b3" +VERSION = "1.0.0" diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/_resource_graph_client.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/_resource_graph_client.py index 3f4d05b1a0d1..e460f03bb778 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/_resource_graph_client.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/_resource_graph_client.py @@ -37,7 +37,7 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = ResourceGraphClientConfiguration(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)} self._serialize = Serializer(client_models) @@ -74,5 +74,5 @@ async def __aenter__(self) -> "ResourceGraphClient": 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/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_operations.py index 381aa4b7ed18..48ba07d83835 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,10 +29,6 @@ from ...operations._operations import build_list_request from .._vendor import ResourceGraphClientMixinABC -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,7 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -109,8 +104,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_resource_graph_client_operations.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_resource_graph_client_operations.py index 38d4c55b6f54..fe50aa477e20 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_resource_graph_client_operations.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/aio/operations/_resource_graph_client_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, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -34,15 +33,6 @@ ) from .._vendor import ResourceGraphClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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 -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,6 +44,9 @@ async def resources( ) -> _models.QueryResponse: """Queries the resources managed by Azure Resource Manager for scopes specified in the request. + .. seealso:: + - https://aka.ms/resource-graph/learntoquery + :param query: Request specifying query and its options. Required. :type query: ~azure.mgmt.resourcegraph.models.QueryRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -71,6 +64,9 @@ async def resources( ) -> _models.QueryResponse: """Queries the resources managed by Azure Resource Manager for scopes specified in the request. + .. seealso:: + - https://aka.ms/resource-graph/learntoquery + :param query: Request specifying query and its options. Required. :type query: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -86,8 +82,11 @@ async def resources( async def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) -> _models.QueryResponse: """Queries the resources managed by Azure Resource Manager for scopes specified in the request. - :param query: Request specifying query and its options. Is either a model type or a IO type. - Required. + .. seealso:: + - https://aka.ms/resource-graph/learntoquery + + :param query: Request specifying query and its options. Is either a QueryRequest type or a IO + type. Required. :type query: ~azure.mgmt.resourcegraph.models.QueryRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -108,7 +107,7 @@ async def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + 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)) cls: ClsType[_models.QueryResponse] = kwargs.pop("cls", None) @@ -132,8 +131,9 @@ async def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -155,7 +155,7 @@ async def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) @overload async def resources_history( self, request: _models.ResourcesHistoryRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: + ) -> Dict[str, Any]: """List all snapshots of a resource for a given time interval. :param request: Request specifying the query and its options. Required. @@ -164,13 +164,15 @@ async def resources_history( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: dict mapping str to any or the result of cls(response) + :rtype: dict[str, any] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def resources_history(self, request: IO, *, content_type: str = "application/json", **kwargs: Any) -> JSON: + async def resources_history( + self, request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> Dict[str, Any]: """List all snapshots of a resource for a given time interval. :param request: Request specifying the query and its options. Required. @@ -179,24 +181,26 @@ async def resources_history(self, request: IO, *, content_type: str = "applicati Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: dict mapping str to any or the result of cls(response) + :rtype: dict[str, any] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any) -> JSON: + async def resources_history( + self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any + ) -> Dict[str, Any]: """List all snapshots of a resource for a given time interval. - :param request: Request specifying the query and its options. Is either a model type or a IO - type. Required. + :param request: Request specifying the query and its options. Is either a + ResourcesHistoryRequest type or a IO type. Required. :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: dict mapping str to any or the result of cls(response) + :rtype: dict[str, any] :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -210,11 +214,9 @@ async def resources_history(self, request: Union[_models.ResourcesHistoryRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-06-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-06-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Dict[str, Any]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -236,8 +238,9 @@ async def resources_history(self, request: Union[_models.ResourcesHistoryRequest request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,7 +250,7 @@ async def resources_history(self, request: Union[_models.ResourcesHistoryRequest error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("{object}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -300,8 +303,8 @@ async def resource_changes( ) -> _models.ResourceChangeList: """List changes to a resource for a given time interval. - :param parameters: the parameters for this request for changes. Is either a model type or a IO - type. Required. + :param parameters: the parameters for this request for changes. Is either a + ResourceChangesRequestParameters type or a IO type. Required. :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -322,9 +325,7 @@ async def resource_changes( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourceChangeList] = kwargs.pop("cls", None) @@ -348,8 +349,9 @@ async def resource_changes( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +415,7 @@ async def resource_change_details( """Get resource change details. :param parameters: The parameters for this request for resource change details. Is either a - model type or a IO type. Required. + ResourceChangeDetailsRequestParameters type or a IO type. Required. :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -434,9 +436,7 @@ async def resource_change_details( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ResourceChangeData]] = kwargs.pop("cls", None) @@ -460,8 +460,9 @@ async def resource_change_details( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py index 4d7255e26d8a..85dbb7c4e9b1 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models_py3.py @@ -46,7 +46,7 @@ class Column(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: Union[str, "_models.ColumnDataType"], **kwargs): + def __init__(self, *, name: str, type: Union[str, "_models.ColumnDataType"], **kwargs: Any) -> None: """ :keyword name: Column name. Required. :paramtype name: str @@ -60,7 +60,8 @@ def __init__(self, *, name: str, type: Union[str, "_models.ColumnDataType"], **k class DateTimeInterval(_serialization.Model): - """An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. ``[start, end)``. + """An interval in time specifying the date and time for the inclusive start and exclusive end, + i.e. ``[start, end)``. All required parameters must be populated in order to send to Azure. @@ -84,7 +85,7 @@ class DateTimeInterval(_serialization.Model): "end": {"key": "end", "type": "iso-8601"}, } - def __init__(self, *, start: datetime.datetime, end: datetime.datetime, **kwargs): + def __init__(self, *, start: datetime.datetime, end: datetime.datetime, **kwargs: Any) -> None: """ :keyword start: A datetime indicating the inclusive/closed start of the time interval, i.e. ``[``\ **\ ``start``\ **\ ``, end)``. Specifying a ``start`` that occurs chronologically after @@ -124,7 +125,9 @@ class Error(_serialization.Model): "details": {"key": "details", "type": "[ErrorDetails]"}, } - def __init__(self, *, code: str, message: str, details: Optional[List["_models.ErrorDetails"]] = None, **kwargs): + def __init__( + self, *, code: str, message: str, details: Optional[List["_models.ErrorDetails"]] = None, **kwargs: Any + ) -> None: """ :keyword code: Error code identifying the specific error. Required. :paramtype code: str @@ -164,7 +167,9 @@ class ErrorDetails(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: str, message: str, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs): + def __init__( + self, *, code: str, message: str, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -197,7 +202,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "Error"}, } - def __init__(self, *, error: "_models.Error", **kwargs): + def __init__(self, *, error: "_models.Error", **kwargs: Any) -> None: """ :keyword error: Error information. Required. :paramtype error: ~azure.mgmt.resourcegraph.models.Error @@ -207,7 +212,8 @@ def __init__(self, *, error: "_models.Error", **kwargs): class Facet(_serialization.Model): - """A facet containing additional statistics on the response of a query. Can be either FacetResult or FacetError. + """A facet containing additional statistics on the response of a query. Can be either FacetResult + or FacetError. You probably want to use the sub-classes and not this class directly. Known sub-classes are: FacetError, FacetResult @@ -232,7 +238,7 @@ class Facet(_serialization.Model): _subtype_map = {"result_type": {"FacetError": "FacetError", "FacetResult": "FacetResult"}} - def __init__(self, *, expression: str, **kwargs): + def __init__(self, *, expression: str, **kwargs: Any) -> None: """ :keyword expression: Facet expression, same as in the corresponding facet request. Required. :paramtype expression: str @@ -267,7 +273,7 @@ class FacetError(Facet): "errors": {"key": "errors", "type": "[ErrorDetails]"}, } - def __init__(self, *, expression: str, errors: List["_models.ErrorDetails"], **kwargs): + def __init__(self, *, expression: str, errors: List["_models.ErrorDetails"], **kwargs: Any) -> None: """ :keyword expression: Facet expression, same as in the corresponding facet request. Required. :paramtype expression: str @@ -299,7 +305,9 @@ class FacetRequest(_serialization.Model): "options": {"key": "options", "type": "FacetRequestOptions"}, } - def __init__(self, *, expression: str, options: Optional["_models.FacetRequestOptions"] = None, **kwargs): + def __init__( + self, *, expression: str, options: Optional["_models.FacetRequestOptions"] = None, **kwargs: Any + ) -> None: """ :keyword expression: The column or list of columns to summarize by. Required. :paramtype expression: str @@ -345,8 +353,8 @@ def __init__( sort_order: Union[str, "_models.FacetSortOrder"] = "desc", filter: Optional[str] = None, # pylint: disable=redefined-builtin top: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sort_by: The column name or query expression to sort on. Defaults to count if not present. @@ -401,7 +409,7 @@ class FacetResult(Facet): "data": {"key": "data", "type": "object"}, } - def __init__(self, *, expression: str, total_records: int, count: int, data: JSON, **kwargs): + def __init__(self, *, expression: str, total_records: int, count: int, data: JSON, **kwargs: Any) -> None: """ :keyword expression: Facet expression, same as in the corresponding facet request. Required. :paramtype expression: str @@ -443,8 +451,8 @@ def __init__( name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -486,8 +494,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft Resource Graph. :paramtype provider: str @@ -506,7 +514,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list Resource Graph operations. It contains a list of operations and a URL link to get the next set of results. + """Result of the request to list Resource Graph operations. It contains a list of operations and a + URL link to get the next set of results. :ivar value: List of Resource Graph operations supported by the Resource Graph resource provider. @@ -517,7 +526,7 @@ class OperationListResult(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Resource Graph operations supported by the Resource Graph resource provider. @@ -565,8 +574,8 @@ def __init__( management_groups: Optional[List[str]] = None, options: Optional["_models.QueryRequestOptions"] = None, facets: Optional[List["_models.FacetRequest"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscriptions: Azure subscriptions against which to execute the query. :paramtype subscriptions: list[str] @@ -637,8 +646,8 @@ def __init__( result_format: Optional[Union[str, "_models.ResultFormat"]] = None, allow_partial_scopes: bool = False, authorization_scope_filter: Union[str, "_models.AuthorizationScopeFilter"] = "AtScopeAndBelow", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword skip_token: Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. @@ -718,8 +727,8 @@ def __init__( data: JSON, skip_token: Optional[str] = None, facets: Optional[List["_models.Facet"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword total_records: Number of total records matching the query. Required. :paramtype total_records: int @@ -790,8 +799,8 @@ def __init__( resource_id: Optional[str] = None, change_type: Optional[Union[str, "_models.ChangeType"]] = None, property_changes: Optional[List["_models.ResourcePropertyChange"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: The resource for a change. :paramtype resource_id: str @@ -850,8 +859,8 @@ def __init__( timestamp: datetime.datetime, snapshot_id: Optional[str] = None, content: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword snapshot_id: The ID of the snapshot. :paramtype snapshot_id: str @@ -903,8 +912,8 @@ def __init__( timestamp: datetime.datetime, snapshot_id: Optional[str] = None, content: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword snapshot_id: The ID of the snapshot. :paramtype snapshot_id: str @@ -953,8 +962,8 @@ def __init__( timestamp: datetime.datetime, snapshot_id: Optional[str] = None, content: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword snapshot_id: The ID of the snapshot. :paramtype snapshot_id: str @@ -991,7 +1000,7 @@ class ResourceChangeDetailsRequestParameters(_serialization.Model): "change_ids": {"key": "changeIds", "type": "[str]"}, } - def __init__(self, *, resource_ids: List[str], change_ids: List[str], **kwargs): + def __init__(self, *, resource_ids: List[str], change_ids: List[str], **kwargs: Any) -> None: """ :keyword resource_ids: Specifies the list of resources for a change details request. Required. :paramtype resource_ids: list[str] @@ -1030,8 +1039,8 @@ def __init__( *, changes: Optional[List["_models.ResourceChangeData"]] = None, skip_token: Optional[Any] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword changes: The pageable value returned by the operation, i.e. a list of changes to the resource. @@ -1101,8 +1110,8 @@ def __init__( table: Optional[str] = None, fetch_property_changes: Optional[bool] = None, fetch_snapshots: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_ids: Specifies the list of resources for a changes request. :paramtype resource_ids: list[str] @@ -1157,7 +1166,7 @@ class ResourceChangesRequestParametersInterval(DateTimeInterval): "end": {"key": "end", "type": "iso-8601"}, } - def __init__(self, *, start: datetime.datetime, end: datetime.datetime, **kwargs): + def __init__(self, *, start: datetime.datetime, end: datetime.datetime, **kwargs: Any) -> None: """ :keyword start: A datetime indicating the inclusive/closed start of the time interval, i.e. ``[``\ **\ ``start``\ **\ ``, end)``. Specifying a ``start`` that occurs chronologically after @@ -1211,8 +1220,8 @@ def __init__( property_change_type: Union[str, "_models.PropertyChangeType"], before_value: Optional[str] = None, after_value: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword property_name: The property name. Required. :paramtype property_name: str @@ -1262,8 +1271,8 @@ def __init__( query: Optional[str] = None, options: Optional["_models.ResourcesHistoryRequestOptions"] = None, management_groups: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscriptions: Azure subscriptions against which to execute the query. :paramtype subscriptions: list[str] @@ -1322,8 +1331,8 @@ def __init__( skip: Optional[int] = None, skip_token: Optional[str] = None, result_format: Optional[Union[str, "_models.ResultFormat"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword interval: The time interval used to fetch history. :paramtype interval: ~azure.mgmt.resourcegraph.models.DateTimeInterval @@ -1369,7 +1378,7 @@ class Table(_serialization.Model): "rows": {"key": "rows", "type": "[[object]]"}, } - def __init__(self, *, columns: List["_models.Column"], rows: List[List[JSON]], **kwargs): + def __init__(self, *, columns: List["_models.Column"], rows: List[List[JSON]], **kwargs: Any) -> None: """ :keyword columns: Query result column descriptors. Required. :paramtype columns: list[~azure.mgmt.resourcegraph.models.Column] diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py index 3e16e474ba8f..74fee7d922a2 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +28,6 @@ from .._serialization import Serializer from .._vendor import ResourceGraphClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +39,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "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 @@ -90,7 +85,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -130,8 +125,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py index 0948569f6e83..a6089833e93d 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_operations.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/operations/_resource_graph_client_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, List, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,15 +27,6 @@ from .._serialization import Serializer from .._vendor import ResourceGraphClientMixinABC, _convert_request -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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 -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +38,7 @@ def build_resources_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + 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") @@ -70,9 +60,7 @@ def build_resources_history_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-06-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-06-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -94,9 +82,7 @@ def build_resource_changes_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,9 +104,7 @@ def build_resource_change_details_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,6 +129,9 @@ def resources( ) -> _models.QueryResponse: """Queries the resources managed by Azure Resource Manager for scopes specified in the request. + .. seealso:: + - https://aka.ms/resource-graph/learntoquery + :param query: Request specifying query and its options. Required. :type query: ~azure.mgmt.resourcegraph.models.QueryRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -160,6 +147,9 @@ def resources( def resources(self, query: IO, *, content_type: str = "application/json", **kwargs: Any) -> _models.QueryResponse: """Queries the resources managed by Azure Resource Manager for scopes specified in the request. + .. seealso:: + - https://aka.ms/resource-graph/learntoquery + :param query: Request specifying query and its options. Required. :type query: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -175,8 +165,11 @@ def resources(self, query: IO, *, content_type: str = "application/json", **kwar def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) -> _models.QueryResponse: """Queries the resources managed by Azure Resource Manager for scopes specified in the request. - :param query: Request specifying query and its options. Is either a model type or a IO type. - Required. + .. seealso:: + - https://aka.ms/resource-graph/learntoquery + + :param query: Request specifying query and its options. Is either a QueryRequest type or a IO + type. Required. :type query: ~azure.mgmt.resourcegraph.models.QueryRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -197,7 +190,7 @@ def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) -> _m _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + 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)) cls: ClsType[_models.QueryResponse] = kwargs.pop("cls", None) @@ -221,8 +214,9 @@ def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) -> _m request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,7 +238,7 @@ def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) -> _m @overload def resources_history( self, request: _models.ResourcesHistoryRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: + ) -> Dict[str, Any]: """List all snapshots of a resource for a given time interval. :param request: Request specifying the query and its options. Required. @@ -253,13 +247,15 @@ def resources_history( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: dict mapping str to any or the result of cls(response) + :rtype: dict[str, any] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def resources_history(self, request: IO, *, content_type: str = "application/json", **kwargs: Any) -> JSON: + def resources_history( + self, request: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> Dict[str, Any]: """List all snapshots of a resource for a given time interval. :param request: Request specifying the query and its options. Required. @@ -268,24 +264,24 @@ def resources_history(self, request: IO, *, content_type: str = "application/jso Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: dict mapping str to any or the result of cls(response) + :rtype: dict[str, any] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any) -> JSON: + def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any) -> Dict[str, Any]: """List all snapshots of a resource for a given time interval. - :param request: Request specifying the query and its options. Is either a model type or a IO - type. Required. + :param request: Request specifying the query and its options. Is either a + ResourcesHistoryRequest type or a IO type. Required. :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: dict mapping str to any or the result of cls(response) + :rtype: dict[str, any] :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -299,11 +295,9 @@ def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-06-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-06-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[JSON] = kwargs.pop("cls", None) + cls: ClsType[Dict[str, Any]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -325,8 +319,9 @@ def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -336,7 +331,7 @@ def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize("{object}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -389,8 +384,8 @@ def resource_changes( ) -> _models.ResourceChangeList: """List changes to a resource for a given time interval. - :param parameters: the parameters for this request for changes. Is either a model type or a IO - type. Required. + :param parameters: the parameters for this request for changes. Is either a + ResourceChangesRequestParameters type or a IO type. Required. :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -411,9 +406,7 @@ def resource_changes( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ResourceChangeList] = kwargs.pop("cls", None) @@ -437,8 +430,9 @@ def resource_changes( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,7 +496,7 @@ def resource_change_details( """Get resource change details. :param parameters: The parameters for this request for resource change details. Is either a - model type or a IO type. Required. + ResourceChangeDetailsRequestParameters type or a IO type. Required. :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -523,9 +517,7 @@ def resource_change_details( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2020-09-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2020-09-01-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ResourceChangeData]] = kwargs.pop("cls", None) @@ -549,8 +541,9 @@ def resource_change_details( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response