From 2ad35a94aed7d10cccca0da8665fde8533a9b472 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 29 Sep 2022 20:06:05 +0000 Subject: [PATCH] CodeGen from PR 20792 in Azure/azure-rest-api-specs Merge 1f2b3f6ec79911a5378698d2d4dc787679359ec7 into 4b5fe2fb0a5066c4ff2bd429dbd5e1afda6afab3 --- .../azure-mgmt-resourcegraph/_meta.json | 10 +- .../azure/mgmt/resourcegraph/_metadata.json | 145 --- .../mgmt/resourcegraph/_serialization.py | 2 +- .../azure/mgmt/resourcegraph/_version.py | 2 +- .../aio/operations/_operations.py | 10 +- .../_resource_graph_client_operations.py | 304 +++--- .../mgmt/resourcegraph/models/__init__.py | 4 +- .../mgmt/resourcegraph/models/_models.py | 926 ------------------ .../mgmt/resourcegraph/models/_models_py3.py | 94 +- .../models/_resource_graph_client_enums.py | 19 +- .../resourcegraph/operations/_operations.py | 12 +- .../_resource_graph_client_operations.py | 324 +++--- 12 files changed, 433 insertions(+), 1419 deletions(-) delete mode 100644 sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_metadata.json delete mode 100644 sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py diff --git a/sdk/resources/azure-mgmt-resourcegraph/_meta.json b/sdk/resources/azure-mgmt-resourcegraph/_meta.json index 76798eb68d85..b3831748d20e 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/_meta.json +++ b/sdk/resources/azure-mgmt-resourcegraph/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.8.4", + "autorest": "3.9.2", "use": [ - "@autorest/python@6.0.1", - "@autorest/modelerfour@4.23.5" + "@autorest/python@6.1.6", + "@autorest/modelerfour@4.24.3" ], - "commit": "ee364f685feedb2ad905c682b57117f9006f541f", + "commit": "2995570f512c191697ace695b727f8e380d49915", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/resourcegraph/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-preview-2021-03 --use=@autorest/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", + "autorest_command": "autorest specification/resourcegraph/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.6 --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/_metadata.json b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_metadata.json deleted file mode 100644 index d0d13f7972d3..000000000000 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_metadata.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "chosen_version": "", - "total_api_version_list": ["2020-04-01-preview", "2020-09-01-preview", "2021-03-01"], - "client": { - "name": "ResourceGraphClient", - "filename": "_resource_graph_client", - "description": "Azure Resource Graph API Reference.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ResourceGraphClientConfiguration\"], \"._operations_mixin\": [\"ResourceGraphClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ResourceGraphClientConfiguration\"], \"._operations_mixin\": [\"ResourceGraphClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=None, # type: Optional[str]", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: Optional[str] = None,", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations" - }, - "operation_mixins": { - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}", - "operations": { - "resource_changes" : { - "sync": { - "signature": "def resource_changes(\n self,\n parameters, # type: \"_models.ResourceChangesRequestParameters\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"List changes to a resource for a given time interval.\n\n:param parameters: the parameters for this request for changes.\n:type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceChangeList, or the result of cls(response)\n:rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def resource_changes(\n self,\n parameters: \"_models.ResourceChangesRequestParameters\",\n **kwargs\n) -\u003e \"_models.ResourceChangeList\":\n", - "doc": "\"\"\"List changes to a resource for a given time interval.\n\n:param parameters: the parameters for this request for changes.\n:type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ResourceChangeList, or the result of cls(response)\n:rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "parameters" - }, - "resource_change_details" : { - "sync": { - "signature": "def resource_change_details(\n self,\n parameters, # type: \"_models.ResourceChangeDetailsRequestParameters\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Get resource change details.\n\n:param parameters: The parameters for this request for resource change details.\n:type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of ResourceChangeData, or the result of cls(response)\n:rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def resource_change_details(\n self,\n parameters: \"_models.ResourceChangeDetailsRequestParameters\",\n **kwargs\n) -\u003e List[\"_models.ResourceChangeData\"]:\n", - "doc": "\"\"\"Get resource change details.\n\n:param parameters: The parameters for this request for resource change details.\n:type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of ResourceChangeData, or the result of cls(response)\n:rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "parameters" - }, - "resources" : { - "sync": { - "signature": "def resources(\n self,\n query, # type: \"_models.QueryRequest\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Queries the resources managed by Azure Resource Manager for scopes specified in the request.\n\n:param query: Request specifying query and its options.\n:type query: ~azure.mgmt.resourcegraph.models.QueryRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: QueryResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.resourcegraph.models.QueryResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def resources(\n self,\n query: \"_models.QueryRequest\",\n **kwargs\n) -\u003e \"_models.QueryResponse\":\n", - "doc": "\"\"\"Queries the resources managed by Azure Resource Manager for scopes specified in the request.\n\n:param query: Request specifying query and its options.\n:type query: ~azure.mgmt.resourcegraph.models.QueryRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: QueryResponse, or the result of cls(response)\n:rtype: ~azure.mgmt.resourcegraph.models.QueryResponse\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "query" - }, - "resources_history" : { - "sync": { - "signature": "def resources_history(\n self,\n request, # type: \"_models.ResourcesHistoryRequest\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"List all snapshots of a resource for a given time interval.\n\n:param request:\n:type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: object, or the result of cls(response)\n:rtype: object\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def resources_history(\n self,\n request: \"_models.ResourcesHistoryRequest\",\n **kwargs\n) -\u003e object:\n", - "doc": "\"\"\"List all snapshots of a resource for a given time interval.\n\n:param request:\n:type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: object, or the result of cls(response)\n:rtype: object\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "request" - } - } - } -} \ No newline at end of file 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 648f84cc4e65..7c1dedb5133d 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_serialization.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_serialization.py @@ -1505,7 +1505,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): try: return self(target_obj, data, content_type=content_type) except: - _LOGGER.warning( + _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) return None 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 391acfa5face..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.0b2" +VERSION = "1.0.0" 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 eff3b3327f90..005508356d64 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 @@ -14,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -63,10 +64,15 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: str cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): 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 6108c00ecf0a..c807d69465b2 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 @@ -14,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -44,84 +45,83 @@ class ResourceGraphClientOperationsMixin(MixinABC): @overload - async def resource_changes( - self, - parameters: _models.ResourceChangesRequestParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceChangeList: - """List changes to a resource for a given time interval. + async def resources( + self, query: _models.QueryRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QueryResponse: + """Queries the resources managed by Azure Resource Manager for scopes specified in the request. - :param parameters: the parameters for this request for changes. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters + :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. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceChangeList or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList + :return: QueryResponse or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def resource_changes( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ResourceChangeList: - """List changes to a resource for a given time interval. + async 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. - :param parameters: the parameters for this request for changes. Required. - :type parameters: IO + :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. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceChangeList or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList + :return: QueryResponse or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def resource_changes( - self, parameters: Union[_models.ResourceChangesRequestParameters, IO], **kwargs: Any - ) -> _models.ResourceChangeList: - """List changes to a resource for a given time interval. + 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 parameters: the parameters for this request for changes. Is either a model type or a IO - type. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters or IO + :param query: Request specifying query and its options. Is either a model 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. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceChangeList or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList + :return: QueryResponse or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceChangeList] + cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResponse] content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters + if isinstance(query, (IO, bytes)): + _content = query else: - _json = self._serialize.body(parameters, "ResourceChangesRequestParameters") + _json = self._serialize.body(query, "QueryRequest") - request = build_resource_changes_request( + request = build_resources_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resource_changes.metadata["url"], + template_url=self.resources.metadata["url"], headers=_headers, params=_params, ) @@ -139,94 +139,91 @@ async def resource_changes( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceChangeList", pipeline_response) + deserialized = self._deserialize("QueryResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resource_changes.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChanges"} # type: ignore + resources.metadata = {"url": "/providers/Microsoft.ResourceGraph/resources"} # type: ignore @overload - async def resource_change_details( - self, - parameters: _models.ResourceChangeDetailsRequestParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.ResourceChangeData]: - """Get resource change details. + async def resources_history( + self, request: _models.ResourcesHistoryRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + """List all snapshots of a resource for a given time interval. - :param parameters: The parameters for this request for resource change details. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters + :param request: Request specifying the query and its options. Required. + :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of ResourceChangeData or the result of cls(response) - :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :return: JSON or the result of cls(response) + :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def resource_change_details( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> List[_models.ResourceChangeData]: - """Get resource change details. + async def resources_history(self, request: IO, *, content_type: str = "application/json", **kwargs: Any) -> JSON: + """List all snapshots of a resource for a given time interval. - :param parameters: The parameters for this request for resource change details. Required. - :type parameters: IO + :param request: Request specifying the query and its options. Required. + :type request: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of ResourceChangeData or the result of cls(response) - :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :return: JSON or the result of cls(response) + :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def resource_change_details( - self, parameters: Union[_models.ResourceChangeDetailsRequestParameters, IO], **kwargs: Any - ) -> List[_models.ResourceChangeData]: - """Get resource change details. + async def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any) -> JSON: + """List all snapshots of a resource for a given time interval. - :param parameters: The parameters for this request for resource change details. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters or IO + :param request: Request specifying the query and its options. Is either a model 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: list of ResourceChangeData or the result of cls(response) - :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :return: JSON or the result of cls(response) + :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.ResourceChangeData]] + cls = kwargs.pop("cls", None) # type: ClsType[JSON] content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters + if isinstance(request, (IO, bytes)): + _content = request else: - _json = self._serialize.body(parameters, "ResourceChangeDetailsRequestParameters") + _json = self._serialize.body(request, "ResourcesHistoryRequest") - request = build_resource_change_details_request( + request = build_resources_history_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resource_change_details.metadata["url"], + template_url=self.resources_history.metadata["url"], headers=_headers, params=_params, ) @@ -244,88 +241,99 @@ async def resource_change_details( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[ResourceChangeData]", pipeline_response) + deserialized = self._deserialize("object", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resource_change_details.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChangeDetails"} # type: ignore + resources_history.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourcesHistory"} # type: ignore @overload - async def resources( - self, query: _models.QueryRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QueryResponse: - """Queries the resources managed by Azure Resource Manager for scopes specified in the request. + async def resource_changes( + self, + parameters: _models.ResourceChangesRequestParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceChangeList: + """List changes to a resource for a given time interval. - :param query: Request specifying query and its options. Required. - :type query: ~azure.mgmt.resourcegraph.models.QueryRequest + :param parameters: the parameters for this request for changes. Required. + :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResponse or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse + :return: ResourceChangeList or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async 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. + async def resource_changes( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ResourceChangeList: + """List changes to a resource for a given time interval. - :param query: Request specifying query and its options. Required. - :type query: IO + :param parameters: the parameters for this request for changes. Required. + :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResponse or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse + :return: ResourceChangeList or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - 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. + async def resource_changes( + self, parameters: Union[_models.ResourceChangesRequestParameters, IO], **kwargs: Any + ) -> _models.ResourceChangeList: + """List changes to a resource for a given time interval. - :param query: Request specifying query and its options. Is either a model type or a IO type. - Required. - :type query: ~azure.mgmt.resourcegraph.models.QueryRequest or IO + :param parameters: the parameters for this request for changes. Is either a model 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. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResponse or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse + :return: ResourceChangeList or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResponse] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceChangeList] content_type = content_type or "application/json" _json = None _content = None - if isinstance(query, (IO, bytes)): - _content = query + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = self._serialize.body(query, "QueryRequest") + _json = self._serialize.body(parameters, "ResourceChangesRequestParameters") - request = build_resources_request( + request = build_resource_changes_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resources.metadata["url"], + template_url=self.resource_changes.metadata["url"], headers=_headers, params=_params, ) @@ -343,85 +351,99 @@ async def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryResponse", pipeline_response) + deserialized = self._deserialize("ResourceChangeList", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resources.metadata = {"url": "/providers/Microsoft.ResourceGraph/resources"} # type: ignore + resource_changes.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChanges"} # type: ignore @overload - async def resources_history( - self, request: _models.ResourcesHistoryRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - """List all snapshots of a resource for a given time interval. + async def resource_change_details( + self, + parameters: _models.ResourceChangeDetailsRequestParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ResourceChangeData]: + """Get resource change details. - :param request: Required. - :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest + :param parameters: The parameters for this request for resource change details. Required. + :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: list of ResourceChangeData or the result of cls(response) + :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def resources_history(self, request: IO, *, content_type: str = "application/json", **kwargs: Any) -> JSON: - """List all snapshots of a resource for a given time interval. + async def resource_change_details( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> List[_models.ResourceChangeData]: + """Get resource change details. - :param request: Required. - :type request: IO + :param parameters: The parameters for this request for resource change details. Required. + :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: list of ResourceChangeData or the result of cls(response) + :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any) -> JSON: - """List all snapshots of a resource for a given time interval. + async def resource_change_details( + self, parameters: Union[_models.ResourceChangeDetailsRequestParameters, IO], **kwargs: Any + ) -> List[_models.ResourceChangeData]: + """Get resource change details. - :param request: Is either a model type or a IO type. Required. - :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest or IO + :param parameters: The parameters for this request for resource change details. Is either a + model 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. :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: list of ResourceChangeData or the result of cls(response) + :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls = kwargs.pop("cls", None) # type: ClsType[List[_models.ResourceChangeData]] content_type = content_type or "application/json" _json = None _content = None - if isinstance(request, (IO, bytes)): - _content = request + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = self._serialize.body(request, "ResourcesHistoryRequest") + _json = self._serialize.body(parameters, "ResourceChangeDetailsRequestParameters") - request = build_resources_history_request( + request = build_resource_change_details_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resources_history.metadata["url"], + template_url=self.resource_change_details.metadata["url"], headers=_headers, params=_params, ) @@ -439,11 +461,11 @@ 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("[ResourceChangeData]", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resources_history.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourcesHistory"} # type: ignore + resource_change_details.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChangeDetails"} # type: ignore diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py index 6141edcfd39d..0a72803acb94 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/__init__.py @@ -35,12 +35,12 @@ from ._models_py3 import ResourcesHistoryRequestOptions from ._models_py3 import Table +from ._resource_graph_client_enums import AuthorizationScopeFilter from ._resource_graph_client_enums import ChangeCategory from ._resource_graph_client_enums import ChangeType from ._resource_graph_client_enums import ColumnDataType from ._resource_graph_client_enums import FacetSortOrder from ._resource_graph_client_enums import PropertyChangeType -from ._resource_graph_client_enums import ResourcesHistoryRequestOptionsResultFormat from ._resource_graph_client_enums import ResultFormat from ._resource_graph_client_enums import ResultTruncated from ._patch import __all__ as _patch_all @@ -76,12 +76,12 @@ "ResourcesHistoryRequest", "ResourcesHistoryRequestOptions", "Table", + "AuthorizationScopeFilter", "ChangeCategory", "ChangeType", "ColumnDataType", "FacetSortOrder", "PropertyChangeType", - "ResourcesHistoryRequestOptionsResultFormat", "ResultFormat", "ResultTruncated", ] diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py deleted file mode 100644 index 9cfe8ab32970..000000000000 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_models.py +++ /dev/null @@ -1,926 +0,0 @@ -# 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.core.exceptions import HttpResponseError -import msrest.serialization - - -class Column(msrest.serialization.Model): - """Query result column descriptor. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Column name. - :type name: str - :param type: Required. Column data type. Possible values include: "string", "integer", - "number", "boolean", "object". - :type type: str or ~azure.mgmt.resourcegraph.models.ColumnDataType - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs): - super(Column, self).__init__(**kwargs) - self.name = kwargs["name"] - self.type = kwargs["type"] - - -class DateTimeInterval(msrest.serialization.Model): - """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. - - :param start: Required. A datetime indicating the inclusive/closed start of the time interval, - i.e. ``[``\ **\ ``start``\ **\ ``, end)``. Specifying a ``start`` that occurs chronologically - after ``end`` will result in an error. - :type start: ~datetime.datetime - :param end: Required. A datetime indicating the exclusive/open end of the time interval, i.e. - ``[start,``\ **\ ``end``\ **\ ``)``. Specifying an ``end`` that occurs chronologically before - ``start`` will result in an error. - :type end: ~datetime.datetime - """ - - _validation = { - "start": {"required": True}, - "end": {"required": True}, - } - - _attribute_map = { - "start": {"key": "start", "type": "iso-8601"}, - "end": {"key": "end", "type": "iso-8601"}, - } - - def __init__(self, **kwargs): - super(DateTimeInterval, self).__init__(**kwargs) - self.start = kwargs["start"] - self.end = kwargs["end"] - - -class Error(msrest.serialization.Model): - """Error details. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Error code identifying the specific error. - :type code: str - :param message: Required. A human readable error message. - :type message: str - :param details: Error details. - :type details: list[~azure.mgmt.resourcegraph.models.ErrorDetails] - """ - - _validation = { - "code": {"required": True}, - "message": {"required": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetails]"}, - } - - def __init__(self, **kwargs): - super(Error, self).__init__(**kwargs) - self.code = kwargs["code"] - self.message = kwargs["message"] - self.details = kwargs.get("details", None) - - -class ErrorDetails(msrest.serialization.Model): - """Error details. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, object] - :param code: Required. Error code identifying the specific error. - :type code: str - :param message: Required. A human readable error message. - :type message: str - """ - - _validation = { - "code": {"required": True}, - "message": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ErrorDetails, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) - self.code = kwargs["code"] - self.message = kwargs["message"] - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the API. - - All required parameters must be populated in order to send to Azure. - - :param error: Required. Error information. - :type error: ~azure.mgmt.resourcegraph.models.Error - """ - - _validation = { - "error": {"required": True}, - } - - _attribute_map = { - "error": {"key": "error", "type": "Error"}, - } - - def __init__(self, **kwargs): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs["error"] - - -class Facet(msrest.serialization.Model): - """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. - - All required parameters must be populated in order to send to Azure. - - :param expression: Required. Facet expression, same as in the corresponding facet request. - :type expression: str - :param result_type: Required. Result type.Constant filled by server. - :type result_type: str - """ - - _validation = { - "expression": {"required": True}, - "result_type": {"required": True}, - } - - _attribute_map = { - "expression": {"key": "expression", "type": "str"}, - "result_type": {"key": "resultType", "type": "str"}, - } - - _subtype_map = {"result_type": {"FacetError": "FacetError", "FacetResult": "FacetResult"}} - - def __init__(self, **kwargs): - super(Facet, self).__init__(**kwargs) - self.expression = kwargs["expression"] - self.result_type = None # type: Optional[str] - - -class FacetError(Facet): - """A facet whose execution resulted in an error. - - All required parameters must be populated in order to send to Azure. - - :param expression: Required. Facet expression, same as in the corresponding facet request. - :type expression: str - :param result_type: Required. Result type.Constant filled by server. - :type result_type: str - :param errors: Required. An array containing detected facet errors with details. - :type errors: list[~azure.mgmt.resourcegraph.models.ErrorDetails] - """ - - _validation = { - "expression": {"required": True}, - "result_type": {"required": True}, - "errors": {"required": True}, - } - - _attribute_map = { - "expression": {"key": "expression", "type": "str"}, - "result_type": {"key": "resultType", "type": "str"}, - "errors": {"key": "errors", "type": "[ErrorDetails]"}, - } - - def __init__(self, **kwargs): - super(FacetError, self).__init__(**kwargs) - self.result_type = "FacetError" # type: str - self.errors = kwargs["errors"] - - -class FacetRequest(msrest.serialization.Model): - """A request to compute additional statistics (facets) over the query results. - - All required parameters must be populated in order to send to Azure. - - :param expression: Required. The column or list of columns to summarize by. - :type expression: str - :param options: The options for facet evaluation. - :type options: ~azure.mgmt.resourcegraph.models.FacetRequestOptions - """ - - _validation = { - "expression": {"required": True}, - } - - _attribute_map = { - "expression": {"key": "expression", "type": "str"}, - "options": {"key": "options", "type": "FacetRequestOptions"}, - } - - def __init__(self, **kwargs): - super(FacetRequest, self).__init__(**kwargs) - self.expression = kwargs["expression"] - self.options = kwargs.get("options", None) - - -class FacetRequestOptions(msrest.serialization.Model): - """The options for facet evaluation. - - :param sort_by: The column name or query expression to sort on. Defaults to count if not - present. - :type sort_by: str - :param sort_order: The sorting order by the selected column (count by default). Possible values - include: "asc", "desc". Default value: "desc". - :type sort_order: str or ~azure.mgmt.resourcegraph.models.FacetSortOrder - :param filter: Specifies the filter condition for the 'where' clause which will be run on main - query's result, just before the actual faceting. - :type filter: str - :param top: The maximum number of facet rows that should be returned. - :type top: int - """ - - _validation = { - "top": {"maximum": 1000, "minimum": 1}, - } - - _attribute_map = { - "sort_by": {"key": "sortBy", "type": "str"}, - "sort_order": {"key": "sortOrder", "type": "str"}, - "filter": {"key": "filter", "type": "str"}, - "top": {"key": "$top", "type": "int"}, - } - - def __init__(self, **kwargs): - super(FacetRequestOptions, self).__init__(**kwargs) - self.sort_by = kwargs.get("sort_by", None) - self.sort_order = kwargs.get("sort_order", "desc") - self.filter = kwargs.get("filter", None) - self.top = kwargs.get("top", None) - - -class FacetResult(Facet): - """Successfully executed facet containing additional statistics on the response of a query. - - All required parameters must be populated in order to send to Azure. - - :param expression: Required. Facet expression, same as in the corresponding facet request. - :type expression: str - :param result_type: Required. Result type.Constant filled by server. - :type result_type: str - :param total_records: Required. Number of total records in the facet results. - :type total_records: long - :param count: Required. Number of records returned in the facet response. - :type count: int - :param data: Required. A JObject array or Table containing the desired facets. Only present if - the facet is valid. - :type data: object - """ - - _validation = { - "expression": {"required": True}, - "result_type": {"required": True}, - "total_records": {"required": True}, - "count": {"required": True}, - "data": {"required": True}, - } - - _attribute_map = { - "expression": {"key": "expression", "type": "str"}, - "result_type": {"key": "resultType", "type": "str"}, - "total_records": {"key": "totalRecords", "type": "long"}, - "count": {"key": "count", "type": "int"}, - "data": {"key": "data", "type": "object"}, - } - - def __init__(self, **kwargs): - super(FacetResult, self).__init__(**kwargs) - self.result_type = "FacetResult" # type: str - self.total_records = kwargs["total_records"] - self.count = kwargs["count"] - self.data = kwargs["data"] - - -class Operation(msrest.serialization.Model): - """Resource Graph REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.resourcegraph.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - } - - def __init__(self, **kwargs): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.display = kwargs.get("display", None) - self.origin = kwargs.get("origin", None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Resource Graph. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description for the operation. - :type description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get("provider", None) - self.resource = kwargs.get("resource", None) - self.operation = kwargs.get("operation", None) - self.description = kwargs.get("description", None) - - -class OperationListResult(msrest.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. - - :param value: List of Resource Graph operations supported by the Resource Graph resource - provider. - :type value: list[~azure.mgmt.resourcegraph.models.Operation] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - } - - def __init__(self, **kwargs): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - - -class QueryRequest(msrest.serialization.Model): - """Describes a query to be executed. - - All required parameters must be populated in order to send to Azure. - - :param subscriptions: Azure subscriptions against which to execute the query. - :type subscriptions: list[str] - :param management_groups: Azure management groups against which to execute the query. Example: - [ 'mg1', 'mg2' ]. - :type management_groups: list[str] - :param query: Required. The resources query. - :type query: str - :param options: The query evaluation options. - :type options: ~azure.mgmt.resourcegraph.models.QueryRequestOptions - :param facets: An array of facet requests to be computed against the query result. - :type facets: list[~azure.mgmt.resourcegraph.models.FacetRequest] - """ - - _validation = { - "query": {"required": True}, - } - - _attribute_map = { - "subscriptions": {"key": "subscriptions", "type": "[str]"}, - "management_groups": {"key": "managementGroups", "type": "[str]"}, - "query": {"key": "query", "type": "str"}, - "options": {"key": "options", "type": "QueryRequestOptions"}, - "facets": {"key": "facets", "type": "[FacetRequest]"}, - } - - def __init__(self, **kwargs): - super(QueryRequest, self).__init__(**kwargs) - self.subscriptions = kwargs.get("subscriptions", None) - self.management_groups = kwargs.get("management_groups", None) - self.query = kwargs["query"] - self.options = kwargs.get("options", None) - self.facets = kwargs.get("facets", None) - - -class QueryRequestOptions(msrest.serialization.Model): - """The options for query evaluation. - - :param skip_token: Continuation token for pagination, capturing the next page size and offset, - as well as the context of the query. - :type skip_token: str - :param top: The maximum number of rows that the query should return. Overrides the page size - when ``$skipToken`` property is present. - :type top: int - :param skip: The number of rows to skip from the beginning of the results. Overrides the next - page offset when ``$skipToken`` property is present. - :type skip: int - :param result_format: Defines in which format query result returned. Possible values include: - "table", "objectArray". Default value: "objectArray". - :type result_format: str or ~azure.mgmt.resourcegraph.models.ResultFormat - :param allow_partial_scopes: Only applicable for tenant and management group level queries to - decide whether to allow partial scopes for result in case the number of subscriptions exceed - allowed limits. - :type allow_partial_scopes: bool - """ - - _validation = { - "top": {"maximum": 1000, "minimum": 1}, - "skip": {"minimum": 0}, - } - - _attribute_map = { - "skip_token": {"key": "$skipToken", "type": "str"}, - "top": {"key": "$top", "type": "int"}, - "skip": {"key": "$skip", "type": "int"}, - "result_format": {"key": "resultFormat", "type": "str"}, - "allow_partial_scopes": {"key": "allowPartialScopes", "type": "bool"}, - } - - def __init__(self, **kwargs): - super(QueryRequestOptions, self).__init__(**kwargs) - self.skip_token = kwargs.get("skip_token", None) - self.top = kwargs.get("top", None) - self.skip = kwargs.get("skip", None) - self.result_format = kwargs.get("result_format", "objectArray") - self.allow_partial_scopes = kwargs.get("allow_partial_scopes", False) - - -class QueryResponse(msrest.serialization.Model): - """Query result. - - All required parameters must be populated in order to send to Azure. - - :param total_records: Required. Number of total records matching the query. - :type total_records: long - :param count: Required. Number of records returned in the current response. In the case of - paging, this is the number of records in the current page. - :type count: long - :param result_truncated: Required. Indicates whether the query results are truncated. Possible - values include: "true", "false". - :type result_truncated: str or ~azure.mgmt.resourcegraph.models.ResultTruncated - :param skip_token: When present, the value can be passed to a subsequent query call (together - with the same query and scopes used in the current request) to retrieve the next page of data. - :type skip_token: str - :param data: Required. Query output in JObject array or Table format. - :type data: object - :param facets: Query facets. - :type facets: list[~azure.mgmt.resourcegraph.models.Facet] - """ - - _validation = { - "total_records": {"required": True}, - "count": {"required": True}, - "result_truncated": {"required": True}, - "data": {"required": True}, - } - - _attribute_map = { - "total_records": {"key": "totalRecords", "type": "long"}, - "count": {"key": "count", "type": "long"}, - "result_truncated": {"key": "resultTruncated", "type": "str"}, - "skip_token": {"key": "$skipToken", "type": "str"}, - "data": {"key": "data", "type": "object"}, - "facets": {"key": "facets", "type": "[Facet]"}, - } - - def __init__(self, **kwargs): - super(QueryResponse, self).__init__(**kwargs) - self.total_records = kwargs["total_records"] - self.count = kwargs["count"] - self.result_truncated = kwargs["result_truncated"] - self.skip_token = kwargs.get("skip_token", None) - self.data = kwargs["data"] - self.facets = kwargs.get("facets", None) - - -class ResourceChangeData(msrest.serialization.Model): - """Data on a specific change, represented by a pair of before and after resource snapshots. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: The resource for a change. - :type resource_id: str - :param change_id: Required. The change ID. Valid and unique within the specified resource only. - :type change_id: str - :param before_snapshot: Required. The snapshot before the change. - :type before_snapshot: ~azure.mgmt.resourcegraph.models.ResourceChangeDataBeforeSnapshot - :param after_snapshot: Required. The snapshot after the change. - :type after_snapshot: ~azure.mgmt.resourcegraph.models.ResourceChangeDataAfterSnapshot - :param change_type: The change type for snapshot. PropertyChanges will be provided in case of - Update change type. Possible values include: "Create", "Update", "Delete". - :type change_type: str or ~azure.mgmt.resourcegraph.models.ChangeType - :param property_changes: An array of resource property change. - :type property_changes: list[~azure.mgmt.resourcegraph.models.ResourcePropertyChange] - """ - - _validation = { - "change_id": {"required": True}, - "before_snapshot": {"required": True}, - "after_snapshot": {"required": True}, - } - - _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, - "change_id": {"key": "changeId", "type": "str"}, - "before_snapshot": {"key": "beforeSnapshot", "type": "ResourceChangeDataBeforeSnapshot"}, - "after_snapshot": {"key": "afterSnapshot", "type": "ResourceChangeDataAfterSnapshot"}, - "change_type": {"key": "changeType", "type": "str"}, - "property_changes": {"key": "propertyChanges", "type": "[ResourcePropertyChange]"}, - } - - def __init__(self, **kwargs): - super(ResourceChangeData, self).__init__(**kwargs) - self.resource_id = kwargs.get("resource_id", None) - self.change_id = kwargs["change_id"] - self.before_snapshot = kwargs["before_snapshot"] - self.after_snapshot = kwargs["after_snapshot"] - self.change_type = kwargs.get("change_type", None) - self.property_changes = kwargs.get("property_changes", None) - - -class ResourceSnapshotData(msrest.serialization.Model): - """Data on a specific resource snapshot. - - All required parameters must be populated in order to send to Azure. - - :param snapshot_id: The ID of the snapshot. - :type snapshot_id: str - :param timestamp: Required. The time when the snapshot was created. - The snapshot timestamp provides an approximation as to when a modification to a resource was - detected. There can be a difference between the actual modification time and the detection - time. This is due to differences in how operations that modify a resource are processed, - versus how operation that record resource snapshots are processed. - :type timestamp: ~datetime.datetime - :param content: The resource snapshot content (in resourceChangeDetails response only). - :type content: object - """ - - _validation = { - "timestamp": {"required": True}, - } - - _attribute_map = { - "snapshot_id": {"key": "snapshotId", "type": "str"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "content": {"key": "content", "type": "object"}, - } - - def __init__(self, **kwargs): - super(ResourceSnapshotData, self).__init__(**kwargs) - self.snapshot_id = kwargs.get("snapshot_id", None) - self.timestamp = kwargs["timestamp"] - self.content = kwargs.get("content", None) - - -class ResourceChangeDataAfterSnapshot(ResourceSnapshotData): - """The snapshot after the change. - - All required parameters must be populated in order to send to Azure. - - :param snapshot_id: The ID of the snapshot. - :type snapshot_id: str - :param timestamp: Required. The time when the snapshot was created. - The snapshot timestamp provides an approximation as to when a modification to a resource was - detected. There can be a difference between the actual modification time and the detection - time. This is due to differences in how operations that modify a resource are processed, - versus how operation that record resource snapshots are processed. - :type timestamp: ~datetime.datetime - :param content: The resource snapshot content (in resourceChangeDetails response only). - :type content: object - """ - - _validation = { - "timestamp": {"required": True}, - } - - _attribute_map = { - "snapshot_id": {"key": "snapshotId", "type": "str"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "content": {"key": "content", "type": "object"}, - } - - def __init__(self, **kwargs): - super(ResourceChangeDataAfterSnapshot, self).__init__(**kwargs) - - -class ResourceChangeDataBeforeSnapshot(ResourceSnapshotData): - """The snapshot before the change. - - All required parameters must be populated in order to send to Azure. - - :param snapshot_id: The ID of the snapshot. - :type snapshot_id: str - :param timestamp: Required. The time when the snapshot was created. - The snapshot timestamp provides an approximation as to when a modification to a resource was - detected. There can be a difference between the actual modification time and the detection - time. This is due to differences in how operations that modify a resource are processed, - versus how operation that record resource snapshots are processed. - :type timestamp: ~datetime.datetime - :param content: The resource snapshot content (in resourceChangeDetails response only). - :type content: object - """ - - _validation = { - "timestamp": {"required": True}, - } - - _attribute_map = { - "snapshot_id": {"key": "snapshotId", "type": "str"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "content": {"key": "content", "type": "object"}, - } - - def __init__(self, **kwargs): - super(ResourceChangeDataBeforeSnapshot, self).__init__(**kwargs) - - -class ResourceChangeDetailsRequestParameters(msrest.serialization.Model): - """The parameters for a specific change details request. - - All required parameters must be populated in order to send to Azure. - - :param resource_ids: Required. Specifies the list of resources for a change details request. - :type resource_ids: list[str] - :param change_ids: Required. Specifies the list of change IDs for a change details request. - :type change_ids: list[str] - """ - - _validation = { - "resource_ids": {"required": True}, - "change_ids": {"required": True}, - } - - _attribute_map = { - "resource_ids": {"key": "resourceIds", "type": "[str]"}, - "change_ids": {"key": "changeIds", "type": "[str]"}, - } - - def __init__(self, **kwargs): - super(ResourceChangeDetailsRequestParameters, self).__init__(**kwargs) - self.resource_ids = kwargs["resource_ids"] - self.change_ids = kwargs["change_ids"] - - -class ResourceChangeList(msrest.serialization.Model): - """A list of changes associated with a resource over a specific time interval. - - :param changes: The pageable value returned by the operation, i.e. a list of changes to the - resource. - - - * The list is ordered from the most recent changes to the least recent changes. - * This list will be empty if there were no changes during the requested interval. - * The ``Before`` snapshot timestamp value of the oldest change can be outside of the specified - time interval. - :type changes: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] - :param skip_token: Skip token that encodes the skip information while executing the current - request. - :type skip_token: object - """ - - _attribute_map = { - "changes": {"key": "changes", "type": "[ResourceChangeData]"}, - "skip_token": {"key": "$skipToken", "type": "object"}, - } - - def __init__(self, **kwargs): - super(ResourceChangeList, self).__init__(**kwargs) - self.changes = kwargs.get("changes", None) - self.skip_token = kwargs.get("skip_token", None) - - -class ResourceChangesRequestParameters(msrest.serialization.Model): - """The parameters for a specific changes request. - - All required parameters must be populated in order to send to Azure. - - :param resource_ids: Specifies the list of resources for a changes request. - :type resource_ids: list[str] - :param subscription_id: The subscription id of resources to query the changes from. - :type subscription_id: str - :param interval: Required. Specifies the date and time interval for a changes request. - :type interval: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParametersInterval - :param skip_token: Acts as the continuation token for paged responses. - :type skip_token: str - :param top: The maximum number of changes the client can accept in a paged response. - :type top: int - :param table: The table name to query resources from. - :type table: str - :param fetch_property_changes: The flag if set to true will fetch property changes. - :type fetch_property_changes: bool - :param fetch_snapshots: The flag if set to true will fetch change snapshots. - :type fetch_snapshots: bool - """ - - _validation = { - "interval": {"required": True}, - "top": {"maximum": 1000, "minimum": 1}, - } - - _attribute_map = { - "resource_ids": {"key": "resourceIds", "type": "[str]"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "interval": {"key": "interval", "type": "ResourceChangesRequestParametersInterval"}, - "skip_token": {"key": "$skipToken", "type": "str"}, - "top": {"key": "$top", "type": "int"}, - "table": {"key": "table", "type": "str"}, - "fetch_property_changes": {"key": "fetchPropertyChanges", "type": "bool"}, - "fetch_snapshots": {"key": "fetchSnapshots", "type": "bool"}, - } - - def __init__(self, **kwargs): - super(ResourceChangesRequestParameters, self).__init__(**kwargs) - self.resource_ids = kwargs.get("resource_ids", None) - self.subscription_id = kwargs.get("subscription_id", None) - self.interval = kwargs["interval"] - self.skip_token = kwargs.get("skip_token", None) - self.top = kwargs.get("top", None) - self.table = kwargs.get("table", None) - self.fetch_property_changes = kwargs.get("fetch_property_changes", None) - self.fetch_snapshots = kwargs.get("fetch_snapshots", None) - - -class ResourceChangesRequestParametersInterval(DateTimeInterval): - """Specifies the date and time interval for a changes request. - - All required parameters must be populated in order to send to Azure. - - :param start: Required. A datetime indicating the inclusive/closed start of the time interval, - i.e. ``[``\ **\ ``start``\ **\ ``, end)``. Specifying a ``start`` that occurs chronologically - after ``end`` will result in an error. - :type start: ~datetime.datetime - :param end: Required. A datetime indicating the exclusive/open end of the time interval, i.e. - ``[start,``\ **\ ``end``\ **\ ``)``. Specifying an ``end`` that occurs chronologically before - ``start`` will result in an error. - :type end: ~datetime.datetime - """ - - _validation = { - "start": {"required": True}, - "end": {"required": True}, - } - - _attribute_map = { - "start": {"key": "start", "type": "iso-8601"}, - "end": {"key": "end", "type": "iso-8601"}, - } - - def __init__(self, **kwargs): - super(ResourceChangesRequestParametersInterval, self).__init__(**kwargs) - - -class ResourcePropertyChange(msrest.serialization.Model): - """The resource property change. - - All required parameters must be populated in order to send to Azure. - - :param property_name: Required. The property name. - :type property_name: str - :param before_value: The property value in before snapshot. - :type before_value: str - :param after_value: The property value in after snapshot. - :type after_value: str - :param change_category: Required. The change category. Possible values include: "User", - "System". - :type change_category: str or ~azure.mgmt.resourcegraph.models.ChangeCategory - :param property_change_type: Required. The property change Type. Possible values include: - "Insert", "Update", "Remove". - :type property_change_type: str or ~azure.mgmt.resourcegraph.models.PropertyChangeType - """ - - _validation = { - "property_name": {"required": True}, - "change_category": {"required": True}, - "property_change_type": {"required": True}, - } - - _attribute_map = { - "property_name": {"key": "propertyName", "type": "str"}, - "before_value": {"key": "beforeValue", "type": "str"}, - "after_value": {"key": "afterValue", "type": "str"}, - "change_category": {"key": "changeCategory", "type": "str"}, - "property_change_type": {"key": "propertyChangeType", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ResourcePropertyChange, self).__init__(**kwargs) - self.property_name = kwargs["property_name"] - self.before_value = kwargs.get("before_value", None) - self.after_value = kwargs.get("after_value", None) - self.change_category = kwargs["change_category"] - self.property_change_type = kwargs["property_change_type"] - - -class ResourcesHistoryRequest(msrest.serialization.Model): - """ResourcesHistoryRequest. - - :param subscriptions: - :type subscriptions: list[str] - :param query: - :type query: str - :param options: - :type options: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequestOptions - :param management_group_id: - :type management_group_id: str - """ - - _attribute_map = { - "subscriptions": {"key": "subscriptions", "type": "[str]"}, - "query": {"key": "query", "type": "str"}, - "options": {"key": "options", "type": "ResourcesHistoryRequestOptions"}, - "management_group_id": {"key": "managementGroupId", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ResourcesHistoryRequest, self).__init__(**kwargs) - self.subscriptions = kwargs.get("subscriptions", None) - self.query = kwargs.get("query", None) - self.options = kwargs.get("options", None) - self.management_group_id = kwargs.get("management_group_id", None) - - -class ResourcesHistoryRequestOptions(msrest.serialization.Model): - """ResourcesHistoryRequestOptions. - - :param interval: An interval in time specifying the date and time for the inclusive start and - exclusive end, i.e. ``[start, end)``. - :type interval: ~azure.mgmt.resourcegraph.models.DateTimeInterval - :param top: - :type top: int - :param skip: - :type skip: int - :param skip_token: - :type skip_token: str - :param result_format: Possible values include: "table", "objectArray". - :type result_format: str or - ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequestOptionsResultFormat - """ - - _attribute_map = { - "interval": {"key": "interval", "type": "DateTimeInterval"}, - "top": {"key": "$top", "type": "int"}, - "skip": {"key": "$skip", "type": "int"}, - "skip_token": {"key": "$skipToken", "type": "str"}, - "result_format": {"key": "resultFormat", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ResourcesHistoryRequestOptions, self).__init__(**kwargs) - self.interval = kwargs.get("interval", None) - self.top = kwargs.get("top", None) - self.skip = kwargs.get("skip", None) - self.skip_token = kwargs.get("skip_token", None) - self.result_format = kwargs.get("result_format", None) - - -class Table(msrest.serialization.Model): - """Query output in tabular format. - - All required parameters must be populated in order to send to Azure. - - :param columns: Required. Query result column descriptors. - :type columns: list[~azure.mgmt.resourcegraph.models.Column] - :param rows: Required. Query result rows. - :type rows: list[list[object]] - """ - - _validation = { - "columns": {"required": True}, - "rows": {"required": True}, - } - - _attribute_map = { - "columns": {"key": "columns", "type": "[Column]"}, - "rows": {"key": "rows", "type": "[[object]]"}, - } - - def __init__(self, **kwargs): - super(Table, self).__init__(**kwargs) - self.columns = kwargs["columns"] - self.rows = kwargs["rows"] 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 82be97aeda3e..2f150a054ffe 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 @@ -31,7 +31,7 @@ class Column(_serialization.Model): :ivar name: Column name. Required. :vartype name: str :ivar type: Column data type. Required. Known values are: "string", "integer", "number", - "boolean", and "object". + "boolean", "object", and "datetime". :vartype type: str or ~azure.mgmt.resourcegraph.models.ColumnDataType """ @@ -50,7 +50,7 @@ def __init__(self, *, name: str, type: Union[str, "_models.ColumnDataType"], **k :keyword name: Column name. Required. :paramtype name: str :keyword type: Column data type. Required. Known values are: "string", "integer", "number", - "boolean", and "object". + "boolean", "object", and "datetime". :paramtype type: str or ~azure.mgmt.resourcegraph.models.ColumnDataType """ super().__init__(**kwargs) @@ -606,6 +606,11 @@ class QueryRequestOptions(_serialization.Model): decide whether to allow partial scopes for result in case the number of subscriptions exceed allowed limits. :vartype allow_partial_scopes: bool + :ivar authorization_scope_filter: Defines what level of authorization resources should be + returned based on the which subscriptions and management groups are passed as scopes. Known + values are: "AtScopeAndBelow", "AtScopeAndAbove", "AtScopeExact", and "AtScopeAboveAndBelow". + :vartype authorization_scope_filter: str or + ~azure.mgmt.resourcegraph.models.AuthorizationScopeFilter """ _validation = { @@ -619,6 +624,7 @@ class QueryRequestOptions(_serialization.Model): "skip": {"key": "$skip", "type": "int"}, "result_format": {"key": "resultFormat", "type": "str"}, "allow_partial_scopes": {"key": "allowPartialScopes", "type": "bool"}, + "authorization_scope_filter": {"key": "authorizationScopeFilter", "type": "str"}, } def __init__( @@ -627,8 +633,9 @@ def __init__( skip_token: Optional[str] = None, top: Optional[int] = None, skip: Optional[int] = None, - result_format: Union[str, "_models.ResultFormat"] = "objectArray", + result_format: Optional[Union[str, "_models.ResultFormat"]] = None, allow_partial_scopes: bool = False, + authorization_scope_filter: Union[str, "_models.AuthorizationScopeFilter"] = "AtScopeAndBelow", **kwargs ): """ @@ -648,6 +655,11 @@ def __init__( decide whether to allow partial scopes for result in case the number of subscriptions exceed allowed limits. :paramtype allow_partial_scopes: bool + :keyword authorization_scope_filter: Defines what level of authorization resources should be + returned based on the which subscriptions and management groups are passed as scopes. Known + values are: "AtScopeAndBelow", "AtScopeAndAbove", "AtScopeExact", and "AtScopeAboveAndBelow". + :paramtype authorization_scope_filter: str or + ~azure.mgmt.resourcegraph.models.AuthorizationScopeFilter """ super().__init__(**kwargs) self.skip_token = skip_token @@ -655,6 +667,7 @@ def __init__( self.skip = skip self.result_format = result_format self.allow_partial_scopes = allow_partial_scopes + self.authorization_scope_filter = authorization_scope_filter class QueryResponse(_serialization.Model): @@ -1221,23 +1234,24 @@ def __init__( class ResourcesHistoryRequest(_serialization.Model): - """ResourcesHistoryRequest. + """Describes a history request to be executed. - :ivar subscriptions: + :ivar subscriptions: Azure subscriptions against which to execute the query. :vartype subscriptions: list[str] - :ivar query: + :ivar query: The resources query. :vartype query: str - :ivar options: + :ivar options: The history request evaluation options. :vartype options: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequestOptions - :ivar management_group_id: - :vartype management_group_id: str + :ivar management_groups: Azure management groups against which to execute the query. Example: [ + 'mg1', 'mg2' ]. + :vartype management_groups: list[str] """ _attribute_map = { "subscriptions": {"key": "subscriptions", "type": "[str]"}, "query": {"key": "query", "type": "str"}, "options": {"key": "options", "type": "ResourcesHistoryRequestOptions"}, - "management_group_id": {"key": "managementGroupId", "type": "str"}, + "management_groups": {"key": "managementGroups", "type": "[str]"}, } def __init__( @@ -1246,43 +1260,51 @@ def __init__( subscriptions: Optional[List[str]] = None, query: Optional[str] = None, options: Optional["_models.ResourcesHistoryRequestOptions"] = None, - management_group_id: Optional[str] = None, + management_groups: Optional[List[str]] = None, **kwargs ): """ - :keyword subscriptions: + :keyword subscriptions: Azure subscriptions against which to execute the query. :paramtype subscriptions: list[str] - :keyword query: + :keyword query: The resources query. :paramtype query: str - :keyword options: + :keyword options: The history request evaluation options. :paramtype options: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequestOptions - :keyword management_group_id: - :paramtype management_group_id: str + :keyword management_groups: Azure management groups against which to execute the query. + Example: [ 'mg1', 'mg2' ]. + :paramtype management_groups: list[str] """ super().__init__(**kwargs) self.subscriptions = subscriptions self.query = query self.options = options - self.management_group_id = management_group_id + self.management_groups = management_groups class ResourcesHistoryRequestOptions(_serialization.Model): - """ResourcesHistoryRequestOptions. + """The options for history request evaluation. - :ivar interval: An interval in time specifying the date and time for the inclusive start and - exclusive end, i.e. ``[start, end)``. + :ivar interval: The time interval used to fetch history. :vartype interval: ~azure.mgmt.resourcegraph.models.DateTimeInterval - :ivar top: + :ivar top: The maximum number of rows that the query should return. Overrides the page size + when ``$skipToken`` property is present. :vartype top: int - :ivar skip: + :ivar skip: The number of rows to skip from the beginning of the results. Overrides the next + page offset when ``$skipToken`` property is present. :vartype skip: int - :ivar skip_token: + :ivar skip_token: Continuation token for pagination, capturing the next page size and offset, + as well as the context of the query. :vartype skip_token: str - :ivar result_format: Known values are: "table" and "objectArray". - :vartype result_format: str or - ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequestOptionsResultFormat + :ivar result_format: Defines in which format query result returned. Known values are: "table" + and "objectArray". + :vartype result_format: str or ~azure.mgmt.resourcegraph.models.ResultFormat """ + _validation = { + "top": {"maximum": 1000, "minimum": 1}, + "skip": {"minimum": 0}, + } + _attribute_map = { "interval": {"key": "interval", "type": "DateTimeInterval"}, "top": {"key": "$top", "type": "int"}, @@ -1298,22 +1320,24 @@ def __init__( top: Optional[int] = None, skip: Optional[int] = None, skip_token: Optional[str] = None, - result_format: Optional[Union[str, "_models.ResourcesHistoryRequestOptionsResultFormat"]] = None, + result_format: Optional[Union[str, "_models.ResultFormat"]] = None, **kwargs ): """ - :keyword interval: An interval in time specifying the date and time for the inclusive start and - exclusive end, i.e. ``[start, end)``. + :keyword interval: The time interval used to fetch history. :paramtype interval: ~azure.mgmt.resourcegraph.models.DateTimeInterval - :keyword top: + :keyword top: The maximum number of rows that the query should return. Overrides the page size + when ``$skipToken`` property is present. :paramtype top: int - :keyword skip: + :keyword skip: The number of rows to skip from the beginning of the results. Overrides the next + page offset when ``$skipToken`` property is present. :paramtype skip: int - :keyword skip_token: + :keyword skip_token: Continuation token for pagination, capturing the next page size and + offset, as well as the context of the query. :paramtype skip_token: str - :keyword result_format: Known values are: "table" and "objectArray". - :paramtype result_format: str or - ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequestOptionsResultFormat + :keyword result_format: Defines in which format query result returned. Known values are: + "table" and "objectArray". + :paramtype result_format: str or ~azure.mgmt.resourcegraph.models.ResultFormat """ super().__init__(**kwargs) self.interval = interval diff --git a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py index 59e2a3021ba8..8a6b4c3d9e91 100644 --- a/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py +++ b/sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/models/_resource_graph_client_enums.py @@ -10,6 +10,17 @@ from azure.core import CaseInsensitiveEnumMeta +class AuthorizationScopeFilter(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines what level of authorization resources should be returned based on the which + subscriptions and management groups are passed as scopes. + """ + + AT_SCOPE_AND_BELOW = "AtScopeAndBelow" + AT_SCOPE_AND_ABOVE = "AtScopeAndAbove" + AT_SCOPE_EXACT = "AtScopeExact" + AT_SCOPE_ABOVE_AND_BELOW = "AtScopeAboveAndBelow" + + class ChangeCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The change category.""" @@ -33,6 +44,7 @@ class ColumnDataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NUMBER = "number" BOOLEAN = "boolean" OBJECT = "object" + DATETIME = "datetime" class FacetSortOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -50,13 +62,6 @@ class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): REMOVE = "Remove" -class ResourcesHistoryRequestOptionsResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ResourcesHistoryRequestOptionsResultFormat.""" - - TABLE = "table" - OBJECT_ARRAY = "objectArray" - - class ResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines in which format query result returned.""" 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 1bba61b0d779..aa5f393324de 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 @@ -13,6 +13,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.paging import ItemPaged @@ -38,7 +39,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: str accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,10 +85,15 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: str cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): 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 a9e734722c5d..83ac9c3e7665 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 @@ -14,6 +14,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -39,16 +40,16 @@ _SERIALIZER.client_side_validation = False -def build_resource_changes_request(**kwargs: Any) -> HttpRequest: +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 = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resourceChanges") + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resources") # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -61,16 +62,16 @@ def build_resource_changes_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_resource_change_details_request(**kwargs: Any) -> HttpRequest: +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 = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resourceChangeDetails") + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resourcesHistory") # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,16 +84,16 @@ def build_resource_change_details_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_resources_request(**kwargs: Any) -> HttpRequest: +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 = kwargs.pop("api_version", _params.pop("api-version", "2021-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resources") + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resourceChanges") # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,16 +106,16 @@ def build_resources_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_resources_history_request(**kwargs: Any) -> HttpRequest: +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 = kwargs.pop("api_version", _params.pop("api-version", "2020-04-01-preview")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resourcesHistory") + _url = kwargs.pop("template_url", "/providers/Microsoft.ResourceGraph/resourceChangeDetails") # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -129,84 +130,81 @@ def build_resources_history_request(**kwargs: Any) -> HttpRequest: class ResourceGraphClientOperationsMixin(MixinABC): @overload - def resource_changes( - self, - parameters: _models.ResourceChangesRequestParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceChangeList: - """List changes to a resource for a given time interval. + def resources( + self, query: _models.QueryRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QueryResponse: + """Queries the resources managed by Azure Resource Manager for scopes specified in the request. - :param parameters: the parameters for this request for changes. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters + :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. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceChangeList or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList + :return: QueryResponse or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def resource_changes( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ResourceChangeList: - """List changes to a resource for a given time interval. + 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. - :param parameters: the parameters for this request for changes. Required. - :type parameters: IO + :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. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceChangeList or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList + :return: QueryResponse or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def resource_changes( - self, parameters: Union[_models.ResourceChangesRequestParameters, IO], **kwargs: Any - ) -> _models.ResourceChangeList: - """List changes to a resource for a given time interval. + 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 parameters: the parameters for this request for changes. Is either a model type or a IO - type. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters or IO + :param query: Request specifying query and its options. Is either a model 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. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceChangeList or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList + :return: QueryResponse or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceChangeList] + cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResponse] content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters + if isinstance(query, (IO, bytes)): + _content = query else: - _json = self._serialize.body(parameters, "ResourceChangesRequestParameters") + _json = self._serialize.body(query, "QueryRequest") - request = build_resource_changes_request( + request = build_resources_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resource_changes.metadata["url"], + template_url=self.resources.metadata["url"], headers=_headers, params=_params, ) @@ -224,94 +222,91 @@ def resource_changes( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ResourceChangeList", pipeline_response) + deserialized = self._deserialize("QueryResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resource_changes.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChanges"} # type: ignore + resources.metadata = {"url": "/providers/Microsoft.ResourceGraph/resources"} # type: ignore @overload - def resource_change_details( - self, - parameters: _models.ResourceChangeDetailsRequestParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.ResourceChangeData]: - """Get resource change details. + def resources_history( + self, request: _models.ResourcesHistoryRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + """List all snapshots of a resource for a given time interval. - :param parameters: The parameters for this request for resource change details. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters + :param request: Request specifying the query and its options. Required. + :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of ResourceChangeData or the result of cls(response) - :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :return: JSON or the result of cls(response) + :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def resource_change_details( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> List[_models.ResourceChangeData]: - """Get resource change details. + def resources_history(self, request: IO, *, content_type: str = "application/json", **kwargs: Any) -> JSON: + """List all snapshots of a resource for a given time interval. - :param parameters: The parameters for this request for resource change details. Required. - :type parameters: IO + :param request: Request specifying the query and its options. Required. + :type request: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of ResourceChangeData or the result of cls(response) - :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :return: JSON or the result of cls(response) + :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def resource_change_details( - self, parameters: Union[_models.ResourceChangeDetailsRequestParameters, IO], **kwargs: Any - ) -> List[_models.ResourceChangeData]: - """Get resource change details. + def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any) -> JSON: + """List all snapshots of a resource for a given time interval. - :param parameters: The parameters for this request for resource change details. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters or IO + :param request: Request specifying the query and its options. Is either a model 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: list of ResourceChangeData or the result of cls(response) - :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] + :return: JSON or the result of cls(response) + :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.ResourceChangeData]] + cls = kwargs.pop("cls", None) # type: ClsType[JSON] content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters + if isinstance(request, (IO, bytes)): + _content = request else: - _json = self._serialize.body(parameters, "ResourceChangeDetailsRequestParameters") + _json = self._serialize.body(request, "ResourcesHistoryRequest") - request = build_resource_change_details_request( + request = build_resources_history_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resource_change_details.metadata["url"], + template_url=self.resources_history.metadata["url"], headers=_headers, params=_params, ) @@ -329,86 +324,99 @@ def resource_change_details( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("[ResourceChangeData]", pipeline_response) + deserialized = self._deserialize("object", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resource_change_details.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChangeDetails"} # type: ignore + resources_history.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourcesHistory"} # type: ignore @overload - def resources( - self, query: _models.QueryRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QueryResponse: - """Queries the resources managed by Azure Resource Manager for scopes specified in the request. + def resource_changes( + self, + parameters: _models.ResourceChangesRequestParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceChangeList: + """List changes to a resource for a given time interval. - :param query: Request specifying query and its options. Required. - :type query: ~azure.mgmt.resourcegraph.models.QueryRequest + :param parameters: the parameters for this request for changes. Required. + :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangesRequestParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResponse or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse + :return: ResourceChangeList or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList :raises ~azure.core.exceptions.HttpResponseError: """ @overload - 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. + def resource_changes( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ResourceChangeList: + """List changes to a resource for a given time interval. - :param query: Request specifying query and its options. Required. - :type query: IO + :param parameters: the parameters for this request for changes. Required. + :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResponse or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse + :return: ResourceChangeList or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - 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. + def resource_changes( + self, parameters: Union[_models.ResourceChangesRequestParameters, IO], **kwargs: Any + ) -> _models.ResourceChangeList: + """List changes to a resource for a given time interval. - :param query: Request specifying query and its options. Is either a model type or a IO type. - Required. - :type query: ~azure.mgmt.resourcegraph.models.QueryRequest or IO + :param parameters: the parameters for this request for changes. Is either a model 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. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: QueryResponse or the result of cls(response) - :rtype: ~azure.mgmt.resourcegraph.models.QueryResponse + :return: ResourceChangeList or the result of cls(response) + :rtype: ~azure.mgmt.resourcegraph.models.ResourceChangeList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResponse] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceChangeList] content_type = content_type or "application/json" _json = None _content = None - if isinstance(query, (IO, bytes)): - _content = query + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = self._serialize.body(query, "QueryRequest") + _json = self._serialize.body(parameters, "ResourceChangesRequestParameters") - request = build_resources_request( + request = build_resource_changes_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resources.metadata["url"], + template_url=self.resource_changes.metadata["url"], headers=_headers, params=_params, ) @@ -426,85 +434,99 @@ def resources(self, query: Union[_models.QueryRequest, IO], **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueryResponse", pipeline_response) + deserialized = self._deserialize("ResourceChangeList", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resources.metadata = {"url": "/providers/Microsoft.ResourceGraph/resources"} # type: ignore + resource_changes.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChanges"} # type: ignore @overload - def resources_history( - self, request: _models.ResourcesHistoryRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - """List all snapshots of a resource for a given time interval. + def resource_change_details( + self, + parameters: _models.ResourceChangeDetailsRequestParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ResourceChangeData]: + """Get resource change details. - :param request: Required. - :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest + :param parameters: The parameters for this request for resource change details. Required. + :type parameters: ~azure.mgmt.resourcegraph.models.ResourceChangeDetailsRequestParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: list of ResourceChangeData or the result of cls(response) + :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def resources_history(self, request: IO, *, content_type: str = "application/json", **kwargs: Any) -> JSON: - """List all snapshots of a resource for a given time interval. + def resource_change_details( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> List[_models.ResourceChangeData]: + """Get resource change details. - :param request: Required. - :type request: IO + :param parameters: The parameters for this request for resource change details. Required. + :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JSON or the result of cls(response) - :rtype: JSON + :return: list of ResourceChangeData or the result of cls(response) + :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def resources_history(self, request: Union[_models.ResourcesHistoryRequest, IO], **kwargs: Any) -> JSON: - """List all snapshots of a resource for a given time interval. + def resource_change_details( + self, parameters: Union[_models.ResourceChangeDetailsRequestParameters, IO], **kwargs: Any + ) -> List[_models.ResourceChangeData]: + """Get resource change details. - :param request: Is either a model type or a IO type. Required. - :type request: ~azure.mgmt.resourcegraph.models.ResourcesHistoryRequest or IO + :param parameters: The parameters for this request for resource change details. Is either a + model 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. :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: list of ResourceChangeData or the result of cls(response) + :rtype: list[~azure.mgmt.resourcegraph.models.ResourceChangeData] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-09-01-preview")) # type: str content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[JSON] + cls = kwargs.pop("cls", None) # type: ClsType[List[_models.ResourceChangeData]] content_type = content_type or "application/json" _json = None _content = None - if isinstance(request, (IO, bytes)): - _content = request + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = self._serialize.body(request, "ResourcesHistoryRequest") + _json = self._serialize.body(parameters, "ResourceChangeDetailsRequestParameters") - request = build_resources_history_request( + request = build_resource_change_details_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.resources_history.metadata["url"], + template_url=self.resource_change_details.metadata["url"], headers=_headers, params=_params, ) @@ -522,11 +544,11 @@ 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("[ResourceChangeData]", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - resources_history.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourcesHistory"} # type: ignore + resource_change_details.metadata = {"url": "/providers/Microsoft.ResourceGraph/resourceChangeDetails"} # type: ignore