diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml
index 1ace8b669a20..02d6fa0f15b5 100644
--- a/eng/.docsettings.yml
+++ b/eng/.docsettings.yml
@@ -86,6 +86,7 @@ known_content_issues:
- ['sdk/core/azure-nspkg/README.md', '#4554']
- ['sdk/core/azure-servicemanagement-legacy/README.md', '#4554']
- ['sdk/eventgrid/azure-eventgrid/README.md', '#4554']
+ - ['sdk/monitor/azure-monitor-query/README.md', '#4554']
- ['sdk/graphrbac/azure-graphrbac/README.md', '#4554']
- ['sdk/loganalytics/azure-loganalytics/README.md', '#4554']
- ['sdk/schemaregistry/azure-schemaregistry/swagger/README.md', '#4554']
diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/__init__.py b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/__init__.py
index e69de29bb2d1..0c36c2076ba0 100644
--- a/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/__init__.py
+++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/__init__.py
@@ -0,0 +1 @@
+__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/CHANGELOG.md b/sdk/monitor/azure-monitor-query/CHANGELOG.md
new file mode 100644
index 000000000000..73082cae16b5
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/CHANGELOG.md
@@ -0,0 +1,3 @@
+# Release History
+
+## 1.0.0b1 (Unreleased)
\ No newline at end of file
diff --git a/sdk/monitor/azure-monitor-query/MANIFEST.in b/sdk/monitor/azure-monitor-query/MANIFEST.in
new file mode 100644
index 000000000000..f62c1e3abf11
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/MANIFEST.in
@@ -0,0 +1,5 @@
+recursive-include tests *.py *.yaml
+recursive-include samples *.py
+include *.md
+include azure/__init__.py
+include azure/monitor/__init__.py
diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md
new file mode 100644
index 000000000000..bed71fe2b210
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/README.md
@@ -0,0 +1,3 @@
+# Azure Monitor Query client library for Python
+
+TODO
diff --git a/sdk/monitor/azure-monitor-query/azure/__init__.py b/sdk/monitor/azure-monitor-query/azure/__init__.py
new file mode 100644
index 000000000000..0c36c2076ba0
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/__init__.py
@@ -0,0 +1 @@
+__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/__init__.py
new file mode 100644
index 000000000000..0c36c2076ba0
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/__init__.py
@@ -0,0 +1 @@
+__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py
new file mode 100644
index 000000000000..06d818c70bcf
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py
@@ -0,0 +1,37 @@
+# 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.
+# --------------------------------------------------------------------------
+
+from ._log_query_client import LogsClient
+from ._metrics_query_client import MetricsClient
+
+from ._models import (
+ LogsQueryResults,
+ LogsQueryResultTable,
+ LogsQueryResultColumn,
+ MetricsResponse,
+ LogsQueryRequest,
+ LogsQueryBody,
+ LogsBatchResponse
+)
+
+from ._generated.models import MetricNamespaceCollection
+
+from ._version import VERSION
+
+__all__ = [
+ "LogsClient",
+ "LogsBatchResponse",
+ "LogsQueryResults",
+ "LogsQueryResultColumn",
+ "LogsQueryResultTable",
+ "LogsQueryRequest",
+ "LogsQueryBody",
+ "MetricsClient",
+ "MetricsResponse",
+ "MetricNamespaceCollection"
+]
+
+__version__ = VERSION
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/__init__.py
new file mode 100644
index 000000000000..258da4c62dc2
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/__init__.py
@@ -0,0 +1,16 @@
+# 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 ._monitor_query_client import MonitorQueryClient
+__all__ = ['MonitorQueryClient']
+
+try:
+ from ._patch import patch_sdk # type: ignore
+ patch_sdk()
+except ImportError:
+ pass
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_configuration.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_configuration.py
new file mode 100644
index 000000000000..67548b8ab772
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_configuration.py
@@ -0,0 +1,57 @@
+# 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 typing import TYPE_CHECKING
+
+from azure.core.configuration import Configuration
+from azure.core.pipeline import policies
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any
+
+VERSION = "unknown"
+
+class MonitorQueryClientConfiguration(Configuration):
+ """Configuration for MonitorQueryClient.
+
+ Note that all parameters used to create this instance are saved as instance
+ attributes.
+
+ :param host: server parameter.
+ :type host: str
+ """
+
+ def __init__(
+ self,
+ host="https://management.azure.com", # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ if host is None:
+ raise ValueError("Parameter 'host' must not be None.")
+ super(MonitorQueryClientConfiguration, self).__init__(**kwargs)
+
+ self.host = host
+ kwargs.setdefault('sdk_moniker', 'monitorqueryclient/{}'.format(VERSION))
+ self._configure(**kwargs)
+
+ def _configure(
+ self,
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
+ self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
+ self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
+ self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
+ self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
+ self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
+ self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_monitor_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_monitor_query_client.py
new file mode 100644
index 000000000000..431ba6057abc
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/_monitor_query_client.py
@@ -0,0 +1,101 @@
+# 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 typing import TYPE_CHECKING
+
+from azure.core import PipelineClient
+from msrest import Deserializer, Serializer
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Optional
+
+ from azure.core.pipeline.transport import HttpRequest, HttpResponse
+
+from ._configuration import MonitorQueryClientConfiguration
+from .operations import QueryOperations
+from .operations import MetadataOperations
+from .operations import MetricDefinitionsOperations
+from .operations import MetricNamespacesOperations
+from .operations import MetricsOperations
+from . import models
+
+
+class MonitorQueryClient(object):
+ """Azure Monitor Query Python Client.
+
+ :ivar query: QueryOperations operations
+ :vartype query: monitor_query_client.operations.QueryOperations
+ :ivar metadata: MetadataOperations operations
+ :vartype metadata: monitor_query_client.operations.MetadataOperations
+ :ivar metric_definitions: MetricDefinitionsOperations operations
+ :vartype metric_definitions: monitor_query_client.operations.MetricDefinitionsOperations
+ :ivar metric_namespaces: MetricNamespacesOperations operations
+ :vartype metric_namespaces: monitor_query_client.operations.MetricNamespacesOperations
+ :ivar metrics: MetricsOperations operations
+ :vartype metrics: monitor_query_client.operations.MetricsOperations
+ :param host: server parameter.
+ :type host: str
+ :param str base_url: Service URL
+ """
+
+ def __init__(
+ self,
+ host="https://management.azure.com", # type: str
+ base_url=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> None
+ if not base_url:
+ base_url = 'https://api.loganalytics.io/v1'
+ self._config = MonitorQueryClientConfiguration(host, **kwargs)
+ self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
+
+ client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
+ self._serialize = Serializer(client_models)
+ self._serialize.client_side_validation = False
+ self._deserialize = Deserializer(client_models)
+
+ self.query = QueryOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metadata = MetadataOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metric_definitions = MetricDefinitionsOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metric_namespaces = MetricNamespacesOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metrics = MetricsOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+
+ def _send_request(self, http_request, **kwargs):
+ # type: (HttpRequest, Any) -> HttpResponse
+ """Runs the network request through the client's chained policies.
+
+ :param http_request: The network request you want to make. Required.
+ :type http_request: ~azure.core.pipeline.transport.HttpRequest
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
+ :return: The response of your network call. Does not do error handling on your response.
+ :rtype: ~azure.core.pipeline.transport.HttpResponse
+ """
+ http_request.url = self._client.format_url(http_request.url)
+ stream = kwargs.pop("stream", True)
+ pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
+ return pipeline_response.http_response
+
+ def close(self):
+ # type: () -> None
+ self._client.close()
+
+ def __enter__(self):
+ # type: () -> MonitorQueryClient
+ self._client.__enter__()
+ return self
+
+ def __exit__(self, *exc_details):
+ # type: (Any) -> None
+ self._client.__exit__(*exc_details)
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/__init__.py
new file mode 100644
index 000000000000..9682cfa94655
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/__init__.py
@@ -0,0 +1,10 @@
+# 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 ._monitor_query_client import MonitorQueryClient
+__all__ = ['MonitorQueryClient']
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/_configuration.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/_configuration.py
new file mode 100644
index 000000000000..f8dbf2a2c551
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/_configuration.py
@@ -0,0 +1,51 @@
+# 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 typing import Any
+
+from azure.core.configuration import Configuration
+from azure.core.pipeline import policies
+
+VERSION = "unknown"
+
+class MonitorQueryClientConfiguration(Configuration):
+ """Configuration for MonitorQueryClient.
+
+ Note that all parameters used to create this instance are saved as instance
+ attributes.
+
+ :param host: server parameter.
+ :type host: str
+ """
+
+ def __init__(
+ self,
+ host: str = "https://management.azure.com",
+ **kwargs: Any
+ ) -> None:
+ if host is None:
+ raise ValueError("Parameter 'host' must not be None.")
+ super(MonitorQueryClientConfiguration, self).__init__(**kwargs)
+
+ self.host = host
+ kwargs.setdefault('sdk_moniker', 'monitorqueryclient/{}'.format(VERSION))
+ self._configure(**kwargs)
+
+ def _configure(
+ self,
+ **kwargs: Any
+ ) -> None:
+ self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
+ self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
+ self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
+ self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
+ self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
+ self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
+ self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/_monitor_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/_monitor_query_client.py
new file mode 100644
index 000000000000..3afc0571a533
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/_monitor_query_client.py
@@ -0,0 +1,91 @@
+# 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 typing import Any, Optional
+
+from azure.core import AsyncPipelineClient
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+from msrest import Deserializer, Serializer
+
+from ._configuration import MonitorQueryClientConfiguration
+from .operations import QueryOperations
+from .operations import MetadataOperations
+from .operations import MetricDefinitionsOperations
+from .operations import MetricNamespacesOperations
+from .operations import MetricsOperations
+from .. import models
+
+
+class MonitorQueryClient(object):
+ """Azure Monitor Query Python Client.
+
+ :ivar query: QueryOperations operations
+ :vartype query: monitor_query_client.aio.operations.QueryOperations
+ :ivar metadata: MetadataOperations operations
+ :vartype metadata: monitor_query_client.aio.operations.MetadataOperations
+ :ivar metric_definitions: MetricDefinitionsOperations operations
+ :vartype metric_definitions: monitor_query_client.aio.operations.MetricDefinitionsOperations
+ :ivar metric_namespaces: MetricNamespacesOperations operations
+ :vartype metric_namespaces: monitor_query_client.aio.operations.MetricNamespacesOperations
+ :ivar metrics: MetricsOperations operations
+ :vartype metrics: monitor_query_client.aio.operations.MetricsOperations
+ :param host: server parameter.
+ :type host: str
+ :param str base_url: Service URL
+ """
+
+ def __init__(
+ self,
+ host: str = "https://management.azure.com",
+ base_url: Optional[str] = None,
+ **kwargs: Any
+ ) -> None:
+ if not base_url:
+ base_url = 'https://api.loganalytics.io/v1'
+ self._config = MonitorQueryClientConfiguration(host, **kwargs)
+ self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
+
+ client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
+ self._serialize = Serializer(client_models)
+ self._serialize.client_side_validation = False
+ self._deserialize = Deserializer(client_models)
+
+ self.query = QueryOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metadata = MetadataOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metric_definitions = MetricDefinitionsOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metric_namespaces = MetricNamespacesOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+ self.metrics = MetricsOperations(
+ self._client, self._config, self._serialize, self._deserialize)
+
+ async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
+ """Runs the network request through the client's chained policies.
+
+ :param http_request: The network request you want to make. Required.
+ :type http_request: ~azure.core.pipeline.transport.HttpRequest
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
+ :return: The response of your network call. Does not do error handling on your response.
+ :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
+ """
+ http_request.url = self._client.format_url(http_request.url)
+ stream = kwargs.pop("stream", True)
+ pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
+ return pipeline_response.http_response
+
+ async def close(self) -> None:
+ await self._client.close()
+
+ async def __aenter__(self) -> "MonitorQueryClient":
+ await self._client.__aenter__()
+ return self
+
+ async def __aexit__(self, *exc_details) -> None:
+ await self._client.__aexit__(*exc_details)
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/__init__.py
new file mode 100644
index 000000000000..7c1dc25c27bd
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/__init__.py
@@ -0,0 +1,21 @@
+# 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 ._query_operations import QueryOperations
+from ._metadata_operations import MetadataOperations
+from ._metric_definitions_operations import MetricDefinitionsOperations
+from ._metric_namespaces_operations import MetricNamespacesOperations
+from ._metrics_operations import MetricsOperations
+
+__all__ = [
+ 'QueryOperations',
+ 'MetadataOperations',
+ 'MetricDefinitionsOperations',
+ 'MetricNamespacesOperations',
+ 'MetricsOperations',
+]
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metadata_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metadata_operations.py
new file mode 100644
index 000000000000..50cbb4664ad6
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metadata_operations.py
@@ -0,0 +1,152 @@
+# 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 typing import Any, Callable, Dict, Generic, Optional, TypeVar
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class MetadataOperations:
+ """MetadataOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def get(
+ self,
+ workspace_id: str,
+ **kwargs
+ ) -> "_models.MetadataResults":
+ """Gets metadata information.
+
+ Retrieve the metadata information for the workspace, including its schema, functions, workspace
+ info, categories etc.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: MetadataResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.MetadataResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/json"
+
+ # Construct URL
+ url = self.get.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('MetadataResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ get.metadata = {'url': '/workspaces/{workspaceId}/metadata'} # type: ignore
+
+ async def post(
+ self,
+ workspace_id: str,
+ **kwargs
+ ) -> "_models.MetadataResults":
+ """Gets metadata information.
+
+ Retrieve the metadata information for the workspace, including its schema, functions, workspace
+ info, categories etc.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: MetadataResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.MetadataResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/json"
+
+ # Construct URL
+ url = self.post.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.post(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('MetadataResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ post.metadata = {'url': '/workspaces/{workspaceId}/metadata'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metric_definitions_operations.py
new file mode 100644
index 000000000000..72029d2db0e8
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metric_definitions_operations.py
@@ -0,0 +1,116 @@
+# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
+import warnings
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class MetricDefinitionsOperations:
+ """MetricDefinitionsOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ def list(
+ self,
+ resource_uri: str,
+ metricnamespace: Optional[str] = None,
+ **kwargs
+ ) -> AsyncIterable["_models.MetricDefinitionCollection"]:
+ """Lists the metric definitions for the resource.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :param metricnamespace: Metric namespace to query metric definitions for.
+ :type metricnamespace: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response)
+ :rtype: ~azure.core.async_paging.AsyncItemPaged[~monitor_query_client.models.MetricDefinitionCollection]
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ api_version = "2018-01-01"
+ accept = "application/json"
+
+ def prepare_request(next_link=None):
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ if not next_link:
+ # Construct URL
+ url = self.list.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
+ if metricnamespace is not None:
+ query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ else:
+ url = next_link
+ query_parameters = {} # type: Dict[str, Any]
+ request = self._client.get(url, query_parameters, header_parameters)
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize('MetricDefinitionCollection', pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem)
+ return None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response)
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ raise HttpResponseError(response=response, model=error)
+
+ return pipeline_response
+
+ return AsyncItemPaged(
+ get_next, extract_data
+ )
+ list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metric_namespaces_operations.py
new file mode 100644
index 000000000000..068fb365477d
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metric_namespaces_operations.py
@@ -0,0 +1,117 @@
+# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
+import warnings
+
+from azure.core.async_paging import AsyncItemPaged, AsyncList
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class MetricNamespacesOperations:
+ """MetricNamespacesOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ def list(
+ self,
+ resource_uri: str,
+ start_time: Optional[str] = None,
+ **kwargs
+ ) -> AsyncIterable["_models.MetricNamespaceCollection"]:
+ """Lists the metric namespaces for the resource.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :param start_time: The ISO 8601 conform Date start time from which to query for metric
+ namespaces.
+ :type start_time: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either MetricNamespaceCollection or the result of cls(response)
+ :rtype: ~azure.core.async_paging.AsyncItemPaged[~monitor_query_client.models.MetricNamespaceCollection]
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricNamespaceCollection"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ api_version = "2017-12-01-preview"
+ accept = "application/json"
+
+ def prepare_request(next_link=None):
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ if not next_link:
+ # Construct URL
+ url = self.list.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
+ if start_time is not None:
+ query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ else:
+ url = next_link
+ query_parameters = {} # type: Dict[str, Any]
+ request = self._client.get(url, query_parameters, header_parameters)
+ return request
+
+ async def extract_data(pipeline_response):
+ deserialized = self._deserialize('MetricNamespaceCollection', pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem)
+ return None, AsyncList(list_of_elem)
+
+ async def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response)
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ raise HttpResponseError(response=response, model=error)
+
+ return pipeline_response
+
+ return AsyncItemPaged(
+ get_next, extract_data
+ )
+ list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricNamespaces'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metrics_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metrics_operations.py
new file mode 100644
index 000000000000..72851113e0ad
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_metrics_operations.py
@@ -0,0 +1,154 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import datetime
+from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class MetricsOperations:
+ """MetricsOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def list(
+ self,
+ resource_uri: str,
+ timespan: Optional[str] = None,
+ interval: Optional[datetime.timedelta] = None,
+ metricnames: Optional[str] = None,
+ aggregation: Optional[str] = None,
+ top: Optional[int] = None,
+ orderby: Optional[str] = None,
+ filter: Optional[str] = None,
+ result_type: Optional[Union[str, "_models.ResultType"]] = None,
+ metricnamespace: Optional[str] = None,
+ **kwargs
+ ) -> "_models.Response":
+ """**Lists the metric values for a resource**.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :param timespan: The timespan of the query. It is a string with the following format
+ 'startDateTime_ISO/endDateTime_ISO'.
+ :type timespan: str
+ :param interval: The interval (i.e. timegrain) of the query.
+ :type interval: ~datetime.timedelta
+ :param metricnames: The names of the metrics (comma separated) to retrieve.
+ :type metricnames: str
+ :param aggregation: The list of aggregation types (comma separated) to retrieve.
+ :type aggregation: str
+ :param top: The maximum number of records to retrieve.
+ Valid only if $filter is specified.
+ Defaults to 10.
+ :type top: int
+ :param orderby: The aggregation to use for sorting results and the direction of the sort.
+ Only one order can be specified.
+ Examples: sum asc.
+ :type orderby: str
+ :param filter: The **$filter** is used to reduce the set of metric data
+ returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`-
+ Return all time series of C where A = a1 and B = b1 or b2:code:`
`\ **$filter=A eq ‘a1’ and
+ B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`
`- Invalid variant::code:`
`\ **$filter=A
+ eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`
`This is invalid because the
+ logical or operator cannot separate two different metadata names.:code:`
`- Return all time
+ series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq
+ ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and
+ B eq ‘\ *’ and C eq ‘*\ ’**.
+ :type filter: str
+ :param result_type: Reduces the set of data collected. The syntax allowed depends on the
+ operation. See the operation's description for details.
+ :type result_type: str or ~monitor_query_client.models.ResultType
+ :param metricnamespace: Metric namespace to query metric definitions for.
+ :type metricnamespace: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: Response, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.Response
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.Response"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ api_version = "2018-01-01"
+ accept = "application/json"
+
+ # Construct URL
+ url = self.list.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ if timespan is not None:
+ query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str')
+ if interval is not None:
+ query_parameters['interval'] = self._serialize.query("interval", interval, 'duration')
+ if metricnames is not None:
+ query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str')
+ if aggregation is not None:
+ query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str')
+ if top is not None:
+ query_parameters['top'] = self._serialize.query("top", top, 'int')
+ if orderby is not None:
+ query_parameters['orderby'] = self._serialize.query("orderby", orderby, 'str')
+ if filter is not None:
+ query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
+ if result_type is not None:
+ query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'str')
+ query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
+ if metricnamespace is not None:
+ query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('Response', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_query_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_query_operations.py
new file mode 100644
index 000000000000..4c49db9b9c04
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/aio/operations/_query_operations.py
@@ -0,0 +1,235 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import datetime
+from typing import Any, Callable, Dict, Generic, Optional, TypeVar
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
+
+from ... import models as _models
+
+T = TypeVar('T')
+ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
+
+class QueryOperations:
+ """QueryOperations async operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer) -> None:
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ async def get(
+ self,
+ workspace_id: str,
+ query: str,
+ timespan: Optional[datetime.timedelta] = None,
+ **kwargs
+ ) -> "_models.QueryResults":
+ """Execute an Analytics query.
+
+ Executes an Analytics query for data.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :param query: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :type query: str
+ :param timespan: Optional. The timespan over which to query data. This is an ISO8601 time
+ period value. This timespan is applied in addition to any that are specified in the query
+ expression.
+ :type timespan: ~datetime.timedelta
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: QueryResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.QueryResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/json"
+
+ # Construct URL
+ url = self.get.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['query'] = self._serialize.query("query", query, 'str')
+ if timespan is not None:
+ query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'duration')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('QueryResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ get.metadata = {'url': '/workspaces/{workspaceId}/query'} # type: ignore
+
+ async def execute(
+ self,
+ workspace_id: str,
+ body: "_models.QueryBody",
+ prefer: Optional[str] = None,
+ **kwargs
+ ) -> "_models.QueryResults":
+ """Execute an Analytics query.
+
+ Executes an Analytics query for data. `Here `_ is an example for using POST with an Analytics query.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :param body: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :type body: ~monitor_query_client.models.QueryBody
+ :param prefer: Optional. The prefer header to set server timeout,.
+ :type prefer: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: QueryResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.QueryResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ content_type = kwargs.pop("content_type", "application/json")
+ accept = "application/json"
+
+ # Construct URL
+ url = self.execute.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if prefer is not None:
+ header_parameters['Prefer'] = self._serialize.header("prefer", prefer, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(body, 'QueryBody')
+ body_content_kwargs['content'] = body_content
+ request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('QueryResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ execute.metadata = {'url': '/workspaces/{workspaceId}/query'} # type: ignore
+
+ async def batch(
+ self,
+ body: "_models.BatchRequest",
+ **kwargs
+ ) -> "_models.BatchResponse":
+ """Execute a batch of Analytics queries.
+
+ Executes a batch of Analytics queries for data. `Here
+ `_ is an example for using POST with
+ an Analytics query.
+
+ :param body: The batch request body.
+ :type body: ~monitor_query_client.models.BatchRequest
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: BatchResponse, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.BatchResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ content_type = kwargs.pop("content_type", "application/json")
+ accept = "application/json"
+
+ # Construct URL
+ url = self.batch.metadata['url'] # type: ignore
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(body, 'BatchRequest')
+ body_content_kwargs['content'] = body_content
+ request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('BatchResponse', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ batch.metadata = {'url': '/$batch'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/__init__.py
new file mode 100644
index 000000000000..39e7db918318
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/__init__.py
@@ -0,0 +1,171 @@
+# 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.
+# --------------------------------------------------------------------------
+
+try:
+ from ._models_py3 import BatchRequest
+ from ._models_py3 import BatchResponse
+ from ._models_py3 import BatchResponseError
+ from ._models_py3 import BatchResponseErrorInnerError
+ from ._models_py3 import Column
+ from ._models_py3 import ErrorDetail
+ from ._models_py3 import ErrorDetails
+ from ._models_py3 import ErrorInfo
+ from ._models_py3 import ErrorResponse
+ from ._models_py3 import ErrorResponseAutoGenerated
+ from ._models_py3 import LocalizableString
+ from ._models_py3 import LogQueryRequest
+ from ._models_py3 import LogQueryResponse
+ from ._models_py3 import MetadataApplication
+ from ._models_py3 import MetadataApplicationRelated
+ from ._models_py3 import MetadataCategory
+ from ._models_py3 import MetadataCategoryRelated
+ from ._models_py3 import MetadataFunction
+ from ._models_py3 import MetadataFunctionRelated
+ from ._models_py3 import MetadataPermissions
+ from ._models_py3 import MetadataPermissionsApplicationsItem
+ from ._models_py3 import MetadataPermissionsResourcesItem
+ from ._models_py3 import MetadataPermissionsWorkspacesItem
+ from ._models_py3 import MetadataQuery
+ from ._models_py3 import MetadataQueryRelated
+ from ._models_py3 import MetadataResourceType
+ from ._models_py3 import MetadataResourceTypeRelated
+ from ._models_py3 import MetadataResults
+ from ._models_py3 import MetadataSolution
+ from ._models_py3 import MetadataSolutionRelated
+ from ._models_py3 import MetadataTable
+ from ._models_py3 import MetadataTableColumnsItem
+ from ._models_py3 import MetadataTableRelated
+ from ._models_py3 import MetadataValue
+ from ._models_py3 import MetadataWorkspace
+ from ._models_py3 import MetadataWorkspaceRelated
+ from ._models_py3 import Metric
+ from ._models_py3 import MetricAvailability
+ from ._models_py3 import MetricDefinition
+ from ._models_py3 import MetricDefinitionCollection
+ from ._models_py3 import MetricNamespace
+ from ._models_py3 import MetricNamespaceCollection
+ from ._models_py3 import MetricNamespaceName
+ from ._models_py3 import MetricValue
+ from ._models_py3 import QueryBody
+ from ._models_py3 import QueryResults
+ from ._models_py3 import Response
+ from ._models_py3 import Table
+ from ._models_py3 import TimeSeriesElement
+except (SyntaxError, ImportError):
+ from ._models import BatchRequest # type: ignore
+ from ._models import BatchResponse # type: ignore
+ from ._models import BatchResponseError # type: ignore
+ from ._models import BatchResponseErrorInnerError # type: ignore
+ from ._models import Column # type: ignore
+ from ._models import ErrorDetail # type: ignore
+ from ._models import ErrorDetails # type: ignore
+ from ._models import ErrorInfo # type: ignore
+ from ._models import ErrorResponse # type: ignore
+ from ._models import ErrorResponseAutoGenerated # type: ignore
+ from ._models import LocalizableString # type: ignore
+ from ._models import LogQueryRequest # type: ignore
+ from ._models import LogQueryResponse # type: ignore
+ from ._models import MetadataApplication # type: ignore
+ from ._models import MetadataApplicationRelated # type: ignore
+ from ._models import MetadataCategory # type: ignore
+ from ._models import MetadataCategoryRelated # type: ignore
+ from ._models import MetadataFunction # type: ignore
+ from ._models import MetadataFunctionRelated # type: ignore
+ from ._models import MetadataPermissions # type: ignore
+ from ._models import MetadataPermissionsApplicationsItem # type: ignore
+ from ._models import MetadataPermissionsResourcesItem # type: ignore
+ from ._models import MetadataPermissionsWorkspacesItem # type: ignore
+ from ._models import MetadataQuery # type: ignore
+ from ._models import MetadataQueryRelated # type: ignore
+ from ._models import MetadataResourceType # type: ignore
+ from ._models import MetadataResourceTypeRelated # type: ignore
+ from ._models import MetadataResults # type: ignore
+ from ._models import MetadataSolution # type: ignore
+ from ._models import MetadataSolutionRelated # type: ignore
+ from ._models import MetadataTable # type: ignore
+ from ._models import MetadataTableColumnsItem # type: ignore
+ from ._models import MetadataTableRelated # type: ignore
+ from ._models import MetadataValue # type: ignore
+ from ._models import MetadataWorkspace # type: ignore
+ from ._models import MetadataWorkspaceRelated # type: ignore
+ from ._models import Metric # type: ignore
+ from ._models import MetricAvailability # type: ignore
+ from ._models import MetricDefinition # type: ignore
+ from ._models import MetricDefinitionCollection # type: ignore
+ from ._models import MetricNamespace # type: ignore
+ from ._models import MetricNamespaceCollection # type: ignore
+ from ._models import MetricNamespaceName # type: ignore
+ from ._models import MetricValue # type: ignore
+ from ._models import QueryBody # type: ignore
+ from ._models import QueryResults # type: ignore
+ from ._models import Response # type: ignore
+ from ._models import Table # type: ignore
+ from ._models import TimeSeriesElement # type: ignore
+
+from ._monitor_query_client_enums import (
+ AggregationType,
+ MetadataColumnDataType,
+ ResultType,
+ Unit,
+)
+
+__all__ = [
+ 'BatchRequest',
+ 'BatchResponse',
+ 'BatchResponseError',
+ 'BatchResponseErrorInnerError',
+ 'Column',
+ 'ErrorDetail',
+ 'ErrorDetails',
+ 'ErrorInfo',
+ 'ErrorResponse',
+ 'ErrorResponseAutoGenerated',
+ 'LocalizableString',
+ 'LogQueryRequest',
+ 'LogQueryResponse',
+ 'MetadataApplication',
+ 'MetadataApplicationRelated',
+ 'MetadataCategory',
+ 'MetadataCategoryRelated',
+ 'MetadataFunction',
+ 'MetadataFunctionRelated',
+ 'MetadataPermissions',
+ 'MetadataPermissionsApplicationsItem',
+ 'MetadataPermissionsResourcesItem',
+ 'MetadataPermissionsWorkspacesItem',
+ 'MetadataQuery',
+ 'MetadataQueryRelated',
+ 'MetadataResourceType',
+ 'MetadataResourceTypeRelated',
+ 'MetadataResults',
+ 'MetadataSolution',
+ 'MetadataSolutionRelated',
+ 'MetadataTable',
+ 'MetadataTableColumnsItem',
+ 'MetadataTableRelated',
+ 'MetadataValue',
+ 'MetadataWorkspace',
+ 'MetadataWorkspaceRelated',
+ 'Metric',
+ 'MetricAvailability',
+ 'MetricDefinition',
+ 'MetricDefinitionCollection',
+ 'MetricNamespace',
+ 'MetricNamespaceCollection',
+ 'MetricNamespaceName',
+ 'MetricValue',
+ 'QueryBody',
+ 'QueryResults',
+ 'Response',
+ 'Table',
+ 'TimeSeriesElement',
+ 'AggregationType',
+ 'MetadataColumnDataType',
+ 'ResultType',
+ 'Unit',
+]
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_models.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_models.py
new file mode 100644
index 000000000000..fa6f78ce7625
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_models.py
@@ -0,0 +1,1797 @@
+# 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 BatchRequest(msrest.serialization.Model):
+ """An array of requests.
+
+ :param requests: An single request in a batch.
+ :type requests: list[~monitor_query_client.models.LogQueryRequest]
+ """
+
+ _attribute_map = {
+ 'requests': {'key': 'requests', 'type': '[LogQueryRequest]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(BatchRequest, self).__init__(**kwargs)
+ self.requests = kwargs.get('requests', None)
+
+
+class BatchResponse(msrest.serialization.Model):
+ """Response to a batch.
+
+ :param responses: An array of responses corresponding to each individual request in a batch.
+ :type responses: list[~monitor_query_client.models.LogQueryResponse]
+ :param error: Error response for a batch request.
+ :type error: ~monitor_query_client.models.BatchResponseError
+ """
+
+ _attribute_map = {
+ 'responses': {'key': 'responses', 'type': '[LogQueryResponse]'},
+ 'error': {'key': 'error', 'type': 'BatchResponseError'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(BatchResponse, self).__init__(**kwargs)
+ self.responses = kwargs.get('responses', None)
+ self.error = kwargs.get('error', None)
+
+
+class BatchResponseError(msrest.serialization.Model):
+ """Error response for a batch request.
+
+ :param message: The error message describing the cause of the error.
+ :type message: str
+ :param code: The error code.
+ :type code: str
+ :param inner_error:
+ :type inner_error: ~monitor_query_client.models.BatchResponseErrorInnerError
+ """
+
+ _attribute_map = {
+ 'message': {'key': 'message', 'type': 'str'},
+ 'code': {'key': 'code', 'type': 'str'},
+ 'inner_error': {'key': 'innerError', 'type': 'BatchResponseErrorInnerError'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(BatchResponseError, self).__init__(**kwargs)
+ self.message = kwargs.get('message', None)
+ self.code = kwargs.get('code', None)
+ self.inner_error = kwargs.get('inner_error', None)
+
+
+class BatchResponseErrorInnerError(msrest.serialization.Model):
+ """BatchResponseErrorInnerError.
+
+ :param code:
+ :type code: str
+ :param message:
+ :type message: str
+ :param details:
+ :type details: list[~monitor_query_client.models.ErrorDetails]
+ """
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'details': {'key': 'details', 'type': '[ErrorDetails]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(BatchResponseErrorInnerError, self).__init__(**kwargs)
+ self.code = kwargs.get('code', None)
+ self.message = kwargs.get('message', None)
+ self.details = kwargs.get('details', None)
+
+
+class Column(msrest.serialization.Model):
+ """A column in a table.
+
+ :param name: The name of this column.
+ :type name: str
+ :param type: The data type of this column.
+ :type type: str
+ """
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(Column, self).__init__(**kwargs)
+ self.name = kwargs.get('name', None)
+ self.type = kwargs.get('type', None)
+
+
+class ErrorDetail(msrest.serialization.Model):
+ """Error details.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param code: Required. The error's code.
+ :type code: str
+ :param message: Required. A human readable error message.
+ :type message: str
+ :param target: Indicates which property in the request is responsible for the error.
+ :type target: str
+ :param value: Indicates which value in 'target' is responsible for the error.
+ :type value: str
+ :param resources: Indicates resources which were responsible for the error.
+ :type resources: list[str]
+ :param additional_properties: Additional properties that can be provided on the error details
+ object.
+ :type additional_properties: object
+ """
+
+ _validation = {
+ 'code': {'required': True},
+ 'message': {'required': True},
+ }
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'target': {'key': 'target', 'type': 'str'},
+ 'value': {'key': 'value', 'type': 'str'},
+ 'resources': {'key': 'resources', 'type': '[str]'},
+ 'additional_properties': {'key': 'additionalProperties', 'type': 'object'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(ErrorDetail, self).__init__(**kwargs)
+ self.code = kwargs['code']
+ self.message = kwargs['message']
+ self.target = kwargs.get('target', None)
+ self.value = kwargs.get('value', None)
+ self.resources = kwargs.get('resources', None)
+ self.additional_properties = kwargs.get('additional_properties', None)
+
+
+class ErrorDetails(msrest.serialization.Model):
+ """ErrorDetails.
+
+ :param code:
+ :type code: str
+ :param message:
+ :type message: str
+ :param target:
+ :type target: str
+ """
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'target': {'key': 'target', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(ErrorDetails, self).__init__(**kwargs)
+ self.code = kwargs.get('code', None)
+ self.message = kwargs.get('message', None)
+ self.target = kwargs.get('target', None)
+
+
+class ErrorInfo(msrest.serialization.Model):
+ """The code and message for an error.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param code: Required. A machine readable error code.
+ :type code: str
+ :param message: Required. A human readable error message.
+ :type message: str
+ :param details: error details.
+ :type details: list[~monitor_query_client.models.ErrorDetail]
+ :param innererror: Inner error details if they exist.
+ :type innererror: ~monitor_query_client.models.ErrorInfo
+ :param additional_properties: Additional properties that can be provided on the error info
+ object.
+ :type additional_properties: object
+ """
+
+ _validation = {
+ 'code': {'required': True},
+ 'message': {'required': True},
+ }
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'details': {'key': 'details', 'type': '[ErrorDetail]'},
+ 'innererror': {'key': 'innererror', 'type': 'ErrorInfo'},
+ 'additional_properties': {'key': 'additionalProperties', 'type': 'object'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(ErrorInfo, self).__init__(**kwargs)
+ self.code = kwargs['code']
+ self.message = kwargs['message']
+ self.details = kwargs.get('details', None)
+ self.innererror = kwargs.get('innererror', None)
+ self.additional_properties = kwargs.get('additional_properties', None)
+
+
+class ErrorResponse(msrest.serialization.Model):
+ """Contains details when the response code indicates an error.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param error: Required. The error details.
+ :type error: ~monitor_query_client.models.ErrorInfo
+ """
+
+ _validation = {
+ 'error': {'required': True},
+ }
+
+ _attribute_map = {
+ 'error': {'key': 'error', 'type': 'ErrorInfo'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(ErrorResponse, self).__init__(**kwargs)
+ self.error = kwargs['error']
+
+
+class ErrorResponseAutoGenerated(msrest.serialization.Model):
+ """Describes the format of Error response.
+
+ :param code: Error code.
+ :type code: str
+ :param message: Error message indicating why the operation failed.
+ :type message: str
+ """
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(ErrorResponseAutoGenerated, self).__init__(**kwargs)
+ self.code = kwargs.get('code', None)
+ self.message = kwargs.get('message', None)
+
+
+class LocalizableString(msrest.serialization.Model):
+ """The localizable string class.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param value: Required. the invariant value.
+ :type value: str
+ :param localized_value: the locale specific value.
+ :type localized_value: str
+ """
+
+ _validation = {
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'value': {'key': 'value', 'type': 'str'},
+ 'localized_value': {'key': 'localizedValue', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(LocalizableString, self).__init__(**kwargs)
+ self.value = kwargs['value']
+ self.localized_value = kwargs.get('localized_value', None)
+
+
+class LogQueryRequest(msrest.serialization.Model):
+ """An single request in a batch.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :param id: The error details.
+ :type id: str
+ :param headers: Dictionary of :code:``.
+ :type headers: dict[str, str]
+ :param body: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :type body: ~monitor_query_client.models.QueryBody
+ :ivar path: Default value: "/query".
+ :vartype path: str
+ :ivar method: Default value: "POST".
+ :vartype method: str
+ :param workspace: Workspace Id to be included in the query.
+ :type workspace: str
+ """
+
+ _validation = {
+ 'path': {'constant': True},
+ 'method': {'constant': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'headers': {'key': 'headers', 'type': '{str}'},
+ 'body': {'key': 'body', 'type': 'QueryBody'},
+ 'path': {'key': 'path', 'type': 'str'},
+ 'method': {'key': 'method', 'type': 'str'},
+ 'workspace': {'key': 'workspace', 'type': 'str'},
+ }
+
+ path = "/query"
+ method = "POST"
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(LogQueryRequest, self).__init__(**kwargs)
+ self.id = kwargs.get('id', None)
+ self.headers = kwargs.get('headers', None)
+ self.body = kwargs.get('body', None)
+ self.workspace = kwargs.get('workspace', None)
+
+
+class LogQueryResponse(msrest.serialization.Model):
+ """LogQueryResponse.
+
+ :param id:
+ :type id: str
+ :param status:
+ :type status: int
+ :param body: Contains the tables, columns & rows resulting from a query.
+ :type body: ~monitor_query_client.models.QueryResults
+ """
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'status': {'key': 'status', 'type': 'int'},
+ 'body': {'key': 'body', 'type': 'QueryResults'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(LogQueryResponse, self).__init__(**kwargs)
+ self.id = kwargs.get('id', None)
+ self.status = kwargs.get('status', None)
+ self.body = kwargs.get('body', None)
+
+
+class MetadataApplication(msrest.serialization.Model):
+ """Application Insights apps that were part of the metadata request and that the user has access to.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the Application Insights app.
+ :type id: str
+ :param resource_id: Required. The ARM resource ID of the Application Insights app.
+ :type resource_id: str
+ :param name: Required. The name of the Application Insights app.
+ :type name: str
+ :param region: Required. The Azure region of the Application Insights app.
+ :type region: str
+ :param related: The related metadata items for the Application Insights app.
+ :type related: ~monitor_query_client.models.MetadataApplicationRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'resource_id': {'required': True},
+ 'name': {'required': True},
+ 'region': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'region': {'key': 'region', 'type': 'str'},
+ 'related': {'key': 'related', 'type': 'MetadataApplicationRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataApplication, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.resource_id = kwargs['resource_id']
+ self.name = kwargs['name']
+ self.region = kwargs['region']
+ self.related = kwargs.get('related', None)
+
+
+class MetadataApplicationRelated(msrest.serialization.Model):
+ """The related metadata items for the Application Insights app.
+
+ :param tables: The related tables for the Application Insights app.
+ :type tables: list[str]
+ :param functions: The related functions for the Application Insights app.
+ :type functions: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataApplicationRelated, self).__init__(**kwargs)
+ self.tables = kwargs.get('tables', None)
+ self.functions = kwargs.get('functions', None)
+
+
+class MetadataCategory(msrest.serialization.Model):
+ """Categories are used to group other metadata entities.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the category.
+ :type id: str
+ :param display_name: Required. The display name of the category.
+ :type display_name: str
+ :param description: The description of the category.
+ :type description: str
+ :param related: The related metadata items for the category.
+ :type related: ~monitor_query_client.models.MetadataCategoryRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'display_name': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'related': {'key': 'related', 'type': 'MetadataCategoryRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataCategory, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.display_name = kwargs['display_name']
+ self.description = kwargs.get('description', None)
+ self.related = kwargs.get('related', None)
+
+
+class MetadataCategoryRelated(msrest.serialization.Model):
+ """The related metadata items for the category.
+
+ :param tables: The tables related to the category.
+ :type tables: list[str]
+ :param functions: The functions related to the category.
+ :type functions: list[str]
+ :param resource_types: The resource types related to the category.
+ :type resource_types: list[str]
+ :param queries: The saved queries related to the category.
+ :type queries: list[str]
+ :param solutions: The Log Analytics solutions related to the category.
+ :type solutions: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataCategoryRelated, self).__init__(**kwargs)
+ self.tables = kwargs.get('tables', None)
+ self.functions = kwargs.get('functions', None)
+ self.resource_types = kwargs.get('resource_types', None)
+ self.queries = kwargs.get('queries', None)
+ self.solutions = kwargs.get('solutions', None)
+
+
+class MetadataFunction(msrest.serialization.Model):
+ """Functions are stored Kusto queries that can be specified as part of queries by using their name.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the function.
+ :type id: str
+ :param name: Required. The name of the function, to be used in queries.
+ :type name: str
+ :param parameters: The parameters/arguments of the function, if any.
+ :type parameters: str
+ :param display_name: The display name of the function.
+ :type display_name: str
+ :param description: The description of the function.
+ :type description: str
+ :param body: Required. The KQL body of the function.
+ :type body: str
+ :param tags: A set of tags. The tags associated with the function.
+ :type tags: object
+ :param properties: The properties of the function.
+ :type properties: object
+ :param related: The related metadata items for the function.
+ :type related: ~monitor_query_client.models.MetadataFunctionRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'name': {'required': True},
+ 'body': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'parameters': {'key': 'parameters', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'body': {'key': 'body', 'type': 'str'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataFunctionRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataFunction, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.name = kwargs['name']
+ self.parameters = kwargs.get('parameters', None)
+ self.display_name = kwargs.get('display_name', None)
+ self.description = kwargs.get('description', None)
+ self.body = kwargs['body']
+ self.tags = kwargs.get('tags', None)
+ self.properties = kwargs.get('properties', None)
+ self.related = kwargs.get('related', None)
+
+
+class MetadataFunctionRelated(msrest.serialization.Model):
+ """The related metadata items for the function.
+
+ :param tables: The related tables for the function.
+ :type tables: list[str]
+ :param solutions: The related Log Analytics solutions for the function.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the function.
+ :type resource_types: list[str]
+ :param categories: The related categories for the function.
+ :type categories: list[str]
+ :param workspaces: The related workspaces for the function.
+ :type workspaces: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataFunctionRelated, self).__init__(**kwargs)
+ self.tables = kwargs.get('tables', None)
+ self.solutions = kwargs.get('solutions', None)
+ self.resource_types = kwargs.get('resource_types', None)
+ self.categories = kwargs.get('categories', None)
+ self.workspaces = kwargs.get('workspaces', None)
+
+
+class MetadataPermissions(msrest.serialization.Model):
+ """Permission information for the metadata call, includes apps/workspaces/resource the user didn't have access to.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param workspaces: Required. The permission indication for the workspaces on the metadata
+ request.
+ :type workspaces: list[~monitor_query_client.models.MetadataPermissionsWorkspacesItem]
+ :param resources: The permission indication for the Azure resources on the metadata request.
+ :type resources: list[~monitor_query_client.models.MetadataPermissionsResourcesItem]
+ :param applications: The permission indication for the Application Insights apps on the
+ metadata request.
+ :type applications: list[~monitor_query_client.models.MetadataPermissionsApplicationsItem]
+ """
+
+ _validation = {
+ 'workspaces': {'required': True},
+ }
+
+ _attribute_map = {
+ 'workspaces': {'key': 'workspaces', 'type': '[MetadataPermissionsWorkspacesItem]'},
+ 'resources': {'key': 'resources', 'type': '[MetadataPermissionsResourcesItem]'},
+ 'applications': {'key': 'applications', 'type': '[MetadataPermissionsApplicationsItem]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataPermissions, self).__init__(**kwargs)
+ self.workspaces = kwargs['workspaces']
+ self.resources = kwargs.get('resources', None)
+ self.applications = kwargs.get('applications', None)
+
+
+class MetadataPermissionsApplicationsItem(msrest.serialization.Model):
+ """MetadataPermissionsApplicationsItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param resource_id: Required. The resource ID on the permission indication.
+ :type resource_id: str
+ """
+
+ _validation = {
+ 'resource_id': {'required': True},
+ }
+
+ _attribute_map = {
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataPermissionsApplicationsItem, self).__init__(**kwargs)
+ self.resource_id = kwargs['resource_id']
+
+
+class MetadataPermissionsResourcesItem(msrest.serialization.Model):
+ """MetadataPermissionsResourcesItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param resource_id: Required. The resource ID on the permission indication.
+ :type resource_id: str
+ :param deny_tables: The list of tables that were denied access for the resource ID.
+ :type deny_tables: list[str]
+ """
+
+ _validation = {
+ 'resource_id': {'required': True},
+ }
+
+ _attribute_map = {
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'deny_tables': {'key': 'denyTables', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataPermissionsResourcesItem, self).__init__(**kwargs)
+ self.resource_id = kwargs['resource_id']
+ self.deny_tables = kwargs.get('deny_tables', None)
+
+
+class MetadataPermissionsWorkspacesItem(msrest.serialization.Model):
+ """MetadataPermissionsWorkspacesItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param resource_id: Required. The resource ID on the permission indication.
+ :type resource_id: str
+ :param deny_tables: The list of tables that were denied access for the resource ID.
+ :type deny_tables: list[str]
+ """
+
+ _validation = {
+ 'resource_id': {'required': True},
+ }
+
+ _attribute_map = {
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'deny_tables': {'key': 'denyTables', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataPermissionsWorkspacesItem, self).__init__(**kwargs)
+ self.resource_id = kwargs['resource_id']
+ self.deny_tables = kwargs.get('deny_tables', None)
+
+
+class MetadataQuery(msrest.serialization.Model):
+ """Queries are stored pieces of KQL, along with a list of relevant metadata items.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the query.
+ :type id: str
+ :param display_name: The display name of the query.
+ :type display_name: str
+ :param description: The description of the query.
+ :type description: str
+ :param body: Required. The KQL body of the query.
+ :type body: str
+ :param labels: The user defined labels associated with the query.
+ :type labels: list[str]
+ :param tags: A set of tags. The tags associated with the query.
+ :type tags: object
+ :param properties: The properties of the query.
+ :type properties: object
+ :param related: The related metadata items for the query.
+ :type related: ~monitor_query_client.models.MetadataQueryRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'body': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'body': {'key': 'body', 'type': 'str'},
+ 'labels': {'key': 'labels', 'type': '[str]'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataQueryRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataQuery, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.display_name = kwargs.get('display_name', None)
+ self.description = kwargs.get('description', None)
+ self.body = kwargs['body']
+ self.labels = kwargs.get('labels', None)
+ self.tags = kwargs.get('tags', None)
+ self.properties = kwargs.get('properties', None)
+ self.related = kwargs.get('related', None)
+
+
+class MetadataQueryRelated(msrest.serialization.Model):
+ """The related metadata items for the query.
+
+ :param categories: The related categories for the query.
+ :type categories: list[str]
+ :param solutions: The related Log Analytics solutions for the query.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the query.
+ :type resource_types: list[str]
+ :param tables: The related tables for the query.
+ :type tables: list[str]
+ """
+
+ _attribute_map = {
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataQueryRelated, self).__init__(**kwargs)
+ self.categories = kwargs.get('categories', None)
+ self.solutions = kwargs.get('solutions', None)
+ self.resource_types = kwargs.get('resource_types', None)
+ self.tables = kwargs.get('tables', None)
+
+
+class MetadataResourceType(msrest.serialization.Model):
+ """Metadata about types of Azure resources, containing relevant tables, functions, etc.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the resource-type.
+ :type id: str
+ :param type: Required. The type of the resource-type.
+ :type type: str
+ :param display_name: The display name of the resource-type.
+ :type display_name: str
+ :param description: The description of the resource-type.
+ :type description: str
+ :param labels: The user-defined labels of the resource-type.
+ :type labels: list[str]
+ :param tags: A set of tags. The tags associated with the resource-type.
+ :type tags: object
+ :param properties: The properties of the resource-type.
+ :type properties: object
+ :param related: The related metadata items for the resource-type.
+ :type related: ~monitor_query_client.models.MetadataResourceTypeRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'type': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'labels': {'key': 'labels', 'type': '[str]'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataResourceTypeRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataResourceType, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.type = kwargs['type']
+ self.display_name = kwargs.get('display_name', None)
+ self.description = kwargs.get('description', None)
+ self.labels = kwargs.get('labels', None)
+ self.tags = kwargs.get('tags', None)
+ self.properties = kwargs.get('properties', None)
+ self.related = kwargs.get('related', None)
+
+
+class MetadataResourceTypeRelated(msrest.serialization.Model):
+ """The related metadata items for the resource-type.
+
+ :param tables: The tables related to the resource-type.
+ :type tables: list[str]
+ :param functions: The functions related to the resource-type.
+ :type functions: list[str]
+ :param categories: The categories related to the resource-type.
+ :type categories: list[str]
+ :param queries: The queries related to the resource-type.
+ :type queries: list[str]
+ :param workspaces: The Log Analytics workspaces related to the resource-type.
+ :type workspaces: list[str]
+ :param resources: The Azure resources related to the resource-type.
+ :type resources: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ 'resources': {'key': 'resources', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataResourceTypeRelated, self).__init__(**kwargs)
+ self.tables = kwargs.get('tables', None)
+ self.functions = kwargs.get('functions', None)
+ self.categories = kwargs.get('categories', None)
+ self.queries = kwargs.get('queries', None)
+ self.workspaces = kwargs.get('workspaces', None)
+ self.resources = kwargs.get('resources', None)
+
+
+class MetadataResults(msrest.serialization.Model):
+ """The metadata response for the app, including available tables, etc.
+
+ :param categories: The list of categories that are referenced in this metadata response.
+ :type categories: list[~monitor_query_client.models.MetadataCategory]
+ :param resource_types: The list of resource types that are referenced in this metadata
+ response.
+ :type resource_types: list[~monitor_query_client.models.MetadataResourceType]
+ :param solutions: The list of Log Analytics solutions installed on the workspace.
+ :type solutions: list[~monitor_query_client.models.MetadataSolution]
+ :param tables: The list of tables and columns that comprise the schema of the workspace.
+ :type tables: list[~monitor_query_client.models.MetadataTable]
+ :param functions: The list of functions stored on the workspace, or introduced by solutions
+ etc.
+ :type functions: list[~monitor_query_client.models.MetadataFunction]
+ :param queries: The list of saved queries stored on the workspace, or introduced by solutions,
+ resource types, etc.
+ :type queries: list[~monitor_query_client.models.MetadataQuery]
+ :param applications: The list of Application Insights apps that were referenced in the metadata
+ request.
+ :type applications: list[~monitor_query_client.models.MetadataApplication]
+ :param workspaces: The list of Log Analytics workspaces that were referenced in the metadata
+ request.
+ :type workspaces: list[~monitor_query_client.models.MetadataWorkspace]
+ :param resources: The list of Azure resources that were referenced in the metadata request.
+ :type resources: list[object]
+ :param permissions: The list of permission rules that affected the metadata request.
+ :type permissions: list[~monitor_query_client.models.MetadataPermissions]
+ """
+
+ _validation = {
+ 'categories': {'unique': True},
+ 'resource_types': {'unique': True},
+ 'solutions': {'unique': True},
+ 'tables': {'unique': True},
+ 'functions': {'unique': True},
+ 'queries': {'unique': True},
+ 'applications': {'unique': True},
+ 'workspaces': {'unique': True},
+ 'resources': {'unique': True},
+ 'permissions': {'unique': True},
+ }
+
+ _attribute_map = {
+ 'categories': {'key': 'categories', 'type': '[MetadataCategory]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[MetadataResourceType]'},
+ 'solutions': {'key': 'solutions', 'type': '[MetadataSolution]'},
+ 'tables': {'key': 'tables', 'type': '[MetadataTable]'},
+ 'functions': {'key': 'functions', 'type': '[MetadataFunction]'},
+ 'queries': {'key': 'queries', 'type': '[MetadataQuery]'},
+ 'applications': {'key': 'applications', 'type': '[MetadataApplication]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[MetadataWorkspace]'},
+ 'resources': {'key': 'resources', 'type': '[object]'},
+ 'permissions': {'key': 'permissions', 'type': '[MetadataPermissions]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataResults, self).__init__(**kwargs)
+ self.categories = kwargs.get('categories', None)
+ self.resource_types = kwargs.get('resource_types', None)
+ self.solutions = kwargs.get('solutions', None)
+ self.tables = kwargs.get('tables', None)
+ self.functions = kwargs.get('functions', None)
+ self.queries = kwargs.get('queries', None)
+ self.applications = kwargs.get('applications', None)
+ self.workspaces = kwargs.get('workspaces', None)
+ self.resources = kwargs.get('resources', None)
+ self.permissions = kwargs.get('permissions', None)
+
+
+class MetadataSolution(msrest.serialization.Model):
+ """Solutions can group tables and functions that are associated with a certain Azure Log Analytics offering.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the Log Analytics solution.
+ :type id: str
+ :param name: Required. The name of the Log Analytics solution.
+ :type name: str
+ :param display_name: The display name of the Log Analytics solution.
+ :type display_name: str
+ :param description: The description of the Log Analytics solution.
+ :type description: str
+ :param tags: A set of tags. The tags that are associated with the Log Analytics solution.
+ :type tags: object
+ :param properties: The properties of the Log Analytics solution.
+ :type properties: object
+ :param related: Required. The related metadata items for the Log Analytics solution.
+ :type related: ~monitor_query_client.models.MetadataSolutionRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'name': {'required': True},
+ 'related': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataSolutionRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataSolution, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.name = kwargs['name']
+ self.display_name = kwargs.get('display_name', None)
+ self.description = kwargs.get('description', None)
+ self.tags = kwargs.get('tags', None)
+ self.properties = kwargs.get('properties', None)
+ self.related = kwargs['related']
+
+
+class MetadataSolutionRelated(msrest.serialization.Model):
+ """The related metadata items for the Log Analytics solution.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param tables: Required. The tables related to the Log Analytics solution.
+ :type tables: list[str]
+ :param functions: The functions related to the Log Analytics solution.
+ :type functions: list[str]
+ :param categories: The categories related to the Log Analytics solution.
+ :type categories: list[str]
+ :param queries: The saved queries related to the Log Analytics solution.
+ :type queries: list[str]
+ :param workspaces: The Workspaces referenced in the metadata request that are related to the
+ Log Analytics solution.
+ :type workspaces: list[str]
+ """
+
+ _validation = {
+ 'tables': {'required': True},
+ }
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataSolutionRelated, self).__init__(**kwargs)
+ self.tables = kwargs['tables']
+ self.functions = kwargs.get('functions', None)
+ self.categories = kwargs.get('categories', None)
+ self.queries = kwargs.get('queries', None)
+ self.workspaces = kwargs.get('workspaces', None)
+
+
+class MetadataTable(msrest.serialization.Model):
+ """Tables are part of the workspace schema, and contain a list of columns and a reference to other relevant metadata items.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the table.
+ :type id: str
+ :param name: Required. The name of the table.
+ :type name: str
+ :param description: The description of the table.
+ :type description: str
+ :param timespan_column: The column associated with the timespan query parameter for the table.
+ :type timespan_column: str
+ :param labels: The user defined labels of the table.
+ :type labels: list[str]
+ :param tags: A set of tags. The tags associated with the table.
+ :type tags: object
+ :param properties: The properties of the table.
+ :type properties: object
+ :param columns: The list of columns defined on the table.
+ :type columns: list[~monitor_query_client.models.MetadataTableColumnsItem]
+ :param related: The related metadata items for the table.
+ :type related: ~monitor_query_client.models.MetadataTableRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'name': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'timespan_column': {'key': 'timespanColumn', 'type': 'str'},
+ 'labels': {'key': 'labels', 'type': '[str]'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'columns': {'key': 'columns', 'type': '[MetadataTableColumnsItem]'},
+ 'related': {'key': 'related', 'type': 'MetadataTableRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataTable, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.name = kwargs['name']
+ self.description = kwargs.get('description', None)
+ self.timespan_column = kwargs.get('timespan_column', None)
+ self.labels = kwargs.get('labels', None)
+ self.tags = kwargs.get('tags', None)
+ self.properties = kwargs.get('properties', None)
+ self.columns = kwargs.get('columns', None)
+ self.related = kwargs.get('related', None)
+
+
+class MetadataTableColumnsItem(msrest.serialization.Model):
+ """MetadataTableColumnsItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param name: Required. The name of the column.
+ :type name: str
+ :param description: The description of the column.
+ :type description: str
+ :param type: Required. The data type of the column. Possible values include: "bool",
+ "datetime", "dynamic", "int", "long", "real", "string".
+ :type type: str or ~monitor_query_client.models.MetadataColumnDataType
+ :param is_preferred_facet: A flag indicating this column is a preferred facet.
+ :type is_preferred_facet: bool
+ :param source: an indication of the source of the column, used only when multiple workspaces
+ have conflicting definition for the column.
+ :type source: object
+ """
+
+ _validation = {
+ 'name': {'required': True},
+ 'type': {'required': True},
+ }
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'is_preferred_facet': {'key': 'isPreferredFacet', 'type': 'bool'},
+ 'source': {'key': 'source', 'type': 'object'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataTableColumnsItem, self).__init__(**kwargs)
+ self.name = kwargs['name']
+ self.description = kwargs.get('description', None)
+ self.type = kwargs['type']
+ self.is_preferred_facet = kwargs.get('is_preferred_facet', None)
+ self.source = kwargs.get('source', None)
+
+
+class MetadataTableRelated(msrest.serialization.Model):
+ """The related metadata items for the table.
+
+ :param categories: The related categories for the table.
+ :type categories: list[str]
+ :param solutions: The related Log Analytics solutions for the table.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the table.
+ :type resource_types: list[str]
+ :param workspaces: The related Log Analytics workspaces for the table.
+ :type workspaces: list[str]
+ :param functions: The related functions for the table.
+ :type functions: list[str]
+ :param queries: The related saved queries for the table.
+ :type queries: list[str]
+ """
+
+ _attribute_map = {
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataTableRelated, self).__init__(**kwargs)
+ self.categories = kwargs.get('categories', None)
+ self.solutions = kwargs.get('solutions', None)
+ self.resource_types = kwargs.get('resource_types', None)
+ self.workspaces = kwargs.get('workspaces', None)
+ self.functions = kwargs.get('functions', None)
+ self.queries = kwargs.get('queries', None)
+
+
+class MetadataValue(msrest.serialization.Model):
+ """Represents a metric metadata value.
+
+ :param name: the name of the metadata.
+ :type name: ~monitor_query_client.models.LocalizableString
+ :param value: the value of the metadata.
+ :type value: str
+ """
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'LocalizableString'},
+ 'value': {'key': 'value', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataValue, self).__init__(**kwargs)
+ self.name = kwargs.get('name', None)
+ self.value = kwargs.get('value', None)
+
+
+class MetadataWorkspace(msrest.serialization.Model):
+ """Log Analytics workspaces that were part of the metadata request and that the user has access to.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the Log Analytics workspace.
+ :type id: str
+ :param resource_id: Required. The ARM resource ID of the Log Analytics workspace.
+ :type resource_id: str
+ :param name: Required. The name of the Log Analytics workspace.
+ :type name: str
+ :param region: Required. The Azure region of the Log Analytics workspace.
+ :type region: str
+ :param related: The related metadata items for the Log Analytics workspace.
+ :type related: ~monitor_query_client.models.MetadataWorkspaceRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'resource_id': {'required': True},
+ 'name': {'required': True},
+ 'region': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'region': {'key': 'region', 'type': 'str'},
+ 'related': {'key': 'related', 'type': 'MetadataWorkspaceRelated'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataWorkspace, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.resource_id = kwargs['resource_id']
+ self.name = kwargs['name']
+ self.region = kwargs['region']
+ self.related = kwargs.get('related', None)
+
+
+class MetadataWorkspaceRelated(msrest.serialization.Model):
+ """The related metadata items for the Log Analytics workspace.
+
+ :param tables: The related tables for the Log Analytics workspace.
+ :type tables: list[str]
+ :param solutions: The related Log Analytics solutions for the Log Analytics workspace.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the Log Analytics workspace.
+ :type resource_types: list[str]
+ :param functions: The related functions for the Log Analytics workspace.
+ :type functions: list[str]
+ :param resources: The related Azure resources for the Log Analytics workspace.
+ :type resources: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'resources': {'key': 'resources', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetadataWorkspaceRelated, self).__init__(**kwargs)
+ self.tables = kwargs.get('tables', None)
+ self.solutions = kwargs.get('solutions', None)
+ self.resource_types = kwargs.get('resource_types', None)
+ self.functions = kwargs.get('functions', None)
+ self.resources = kwargs.get('resources', None)
+
+
+class Metric(msrest.serialization.Model):
+ """The result data of a query.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. the metric Id.
+ :type id: str
+ :param type: Required. the resource type of the metric resource.
+ :type type: str
+ :param name: Required. the name and the display name of the metric, i.e. it is localizable
+ string.
+ :type name: ~monitor_query_client.models.LocalizableString
+ :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes",
+ "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds",
+ "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond".
+ :type unit: str or ~monitor_query_client.models.Unit
+ :param timeseries: Required. the time series returned when a data query is performed.
+ :type timeseries: list[~monitor_query_client.models.TimeSeriesElement]
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'type': {'required': True},
+ 'name': {'required': True},
+ 'unit': {'required': True},
+ 'timeseries': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'LocalizableString'},
+ 'unit': {'key': 'unit', 'type': 'str'},
+ 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(Metric, self).__init__(**kwargs)
+ self.id = kwargs['id']
+ self.type = kwargs['type']
+ self.name = kwargs['name']
+ self.unit = kwargs['unit']
+ self.timeseries = kwargs['timeseries']
+
+
+class MetricAvailability(msrest.serialization.Model):
+ """Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain.
+
+ :param time_grain: the time grain specifies the aggregation interval for the metric. Expressed
+ as a duration 'PT1M', 'P1D', etc.
+ :type time_grain: ~datetime.timedelta
+ :param retention: the retention period for the metric at the specified timegrain. Expressed as
+ a duration 'PT1M', 'P1D', etc.
+ :type retention: ~datetime.timedelta
+ """
+
+ _attribute_map = {
+ 'time_grain': {'key': 'timeGrain', 'type': 'duration'},
+ 'retention': {'key': 'retention', 'type': 'duration'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetricAvailability, self).__init__(**kwargs)
+ self.time_grain = kwargs.get('time_grain', None)
+ self.retention = kwargs.get('retention', None)
+
+
+class MetricDefinition(msrest.serialization.Model):
+ """Metric definition class specifies the metadata for a metric.
+
+ :param is_dimension_required: Flag to indicate whether the dimension is required.
+ :type is_dimension_required: bool
+ :param resource_id: the resource identifier of the resource that emitted the metric.
+ :type resource_id: str
+ :param namespace: the namespace the metric belongs to.
+ :type namespace: str
+ :param name: the name and the display name of the metric, i.e. it is a localizable string.
+ :type name: ~monitor_query_client.models.LocalizableString
+ :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds",
+ "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified",
+ "Cores", "MilliCores", "NanoCores", "BitsPerSecond".
+ :type unit: str or ~monitor_query_client.models.Unit
+ :param primary_aggregation_type: the primary aggregation type value defining how to use the
+ values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum",
+ "Total".
+ :type primary_aggregation_type: str or ~monitor_query_client.models.AggregationType
+ :param supported_aggregation_types: the collection of what aggregation types are supported.
+ :type supported_aggregation_types: list[str or ~monitor_query_client.models.AggregationType]
+ :param metric_availabilities: the collection of what aggregation intervals are available to be
+ queried.
+ :type metric_availabilities: list[~monitor_query_client.models.MetricAvailability]
+ :param id: the resource identifier of the metric definition.
+ :type id: str
+ :param dimensions: the name and the display name of the dimension, i.e. it is a localizable
+ string.
+ :type dimensions: list[~monitor_query_client.models.LocalizableString]
+ """
+
+ _attribute_map = {
+ 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'},
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'namespace': {'key': 'namespace', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'LocalizableString'},
+ 'unit': {'key': 'unit', 'type': 'str'},
+ 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'},
+ 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'},
+ 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'},
+ 'id': {'key': 'id', 'type': 'str'},
+ 'dimensions': {'key': 'dimensions', 'type': '[LocalizableString]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetricDefinition, self).__init__(**kwargs)
+ self.is_dimension_required = kwargs.get('is_dimension_required', None)
+ self.resource_id = kwargs.get('resource_id', None)
+ self.namespace = kwargs.get('namespace', None)
+ self.name = kwargs.get('name', None)
+ self.unit = kwargs.get('unit', None)
+ self.primary_aggregation_type = kwargs.get('primary_aggregation_type', None)
+ self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None)
+ self.metric_availabilities = kwargs.get('metric_availabilities', None)
+ self.id = kwargs.get('id', None)
+ self.dimensions = kwargs.get('dimensions', None)
+
+
+class MetricDefinitionCollection(msrest.serialization.Model):
+ """Represents collection of metric definitions.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param value: Required. the values for the metric definitions.
+ :type value: list[~monitor_query_client.models.MetricDefinition]
+ """
+
+ _validation = {
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'value': {'key': 'value', 'type': '[MetricDefinition]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetricDefinitionCollection, self).__init__(**kwargs)
+ self.value = kwargs['value']
+
+
+class MetricNamespace(msrest.serialization.Model):
+ """Metric namespace class specifies the metadata for a metric namespace.
+
+ :param id: The ID of the metricNamespace.
+ :type id: str
+ :param type: The type of the namespace.
+ :type type: str
+ :param name: The name of the namespace.
+ :type name: str
+ :param properties: Properties which include the fully qualified namespace name.
+ :type properties: ~monitor_query_client.models.MetricNamespaceName
+ """
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetricNamespace, self).__init__(**kwargs)
+ self.id = kwargs.get('id', None)
+ self.type = kwargs.get('type', None)
+ self.name = kwargs.get('name', None)
+ self.properties = kwargs.get('properties', None)
+
+
+class MetricNamespaceCollection(msrest.serialization.Model):
+ """Represents collection of metric namespaces.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param value: Required. The values for the metric namespaces.
+ :type value: list[~monitor_query_client.models.MetricNamespace]
+ """
+
+ _validation = {
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'value': {'key': 'value', 'type': '[MetricNamespace]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetricNamespaceCollection, self).__init__(**kwargs)
+ self.value = kwargs['value']
+
+
+class MetricNamespaceName(msrest.serialization.Model):
+ """The fully qualified metric namespace name.
+
+ :param metric_namespace_name: The metric namespace name.
+ :type metric_namespace_name: str
+ """
+
+ _attribute_map = {
+ 'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetricNamespaceName, self).__init__(**kwargs)
+ self.metric_namespace_name = kwargs.get('metric_namespace_name', None)
+
+
+class MetricValue(msrest.serialization.Model):
+ """Represents a metric value.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param time_stamp: Required. the timestamp for the metric value in ISO 8601 format.
+ :type time_stamp: ~datetime.datetime
+ :param average: the average value in the time range.
+ :type average: float
+ :param minimum: the least value in the time range.
+ :type minimum: float
+ :param maximum: the greatest value in the time range.
+ :type maximum: float
+ :param total: the sum of all of the values in the time range.
+ :type total: float
+ :param count: the number of samples in the time range. Can be used to determine the number of
+ values that contributed to the average value.
+ :type count: float
+ """
+
+ _validation = {
+ 'time_stamp': {'required': True},
+ }
+
+ _attribute_map = {
+ 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'},
+ 'average': {'key': 'average', 'type': 'float'},
+ 'minimum': {'key': 'minimum', 'type': 'float'},
+ 'maximum': {'key': 'maximum', 'type': 'float'},
+ 'total': {'key': 'total', 'type': 'float'},
+ 'count': {'key': 'count', 'type': 'float'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(MetricValue, self).__init__(**kwargs)
+ self.time_stamp = kwargs['time_stamp']
+ self.average = kwargs.get('average', None)
+ self.minimum = kwargs.get('minimum', None)
+ self.maximum = kwargs.get('maximum', None)
+ self.total = kwargs.get('total', None)
+ self.count = kwargs.get('count', None)
+
+
+class QueryBody(msrest.serialization.Model):
+ """The Analytics query. Learn more about the `Analytics query syntax `_.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param query: Required. The query to execute.
+ :type query: str
+ :param timespan: Optional. The timespan over which to query data. This is an ISO8601 time
+ period value. This timespan is applied in addition to any that are specified in the query
+ expression.
+ :type timespan: str
+ :param workspaces: A list of workspaces that are included in the query.
+ :type workspaces: list[str]
+ :param qualified_names: A list of qualified workspace names that are included in the query.
+ :type qualified_names: list[str]
+ :param workspace_ids: A list of workspace IDs that are included in the query.
+ :type workspace_ids: list[str]
+ :param azure_resource_ids: A list of Azure resource IDs that are included in the query.
+ :type azure_resource_ids: list[str]
+ """
+
+ _validation = {
+ 'query': {'required': True},
+ }
+
+ _attribute_map = {
+ 'query': {'key': 'query', 'type': 'str'},
+ 'timespan': {'key': 'timespan', 'type': 'str'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ 'qualified_names': {'key': 'qualifiedNames', 'type': '[str]'},
+ 'workspace_ids': {'key': 'workspaceIds', 'type': '[str]'},
+ 'azure_resource_ids': {'key': 'azureResourceIds', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(QueryBody, self).__init__(**kwargs)
+ self.query = kwargs['query']
+ self.timespan = kwargs.get('timespan', None)
+ self.workspaces = kwargs.get('workspaces', None)
+ self.qualified_names = kwargs.get('qualified_names', None)
+ self.workspace_ids = kwargs.get('workspace_ids', None)
+ self.azure_resource_ids = kwargs.get('azure_resource_ids', None)
+
+
+class QueryResults(msrest.serialization.Model):
+ """Contains the tables, columns & rows resulting from a query.
+
+ :param tables: The list of tables, columns and rows.
+ :type tables: list[~monitor_query_client.models.Table]
+ :param errors:
+ :type errors: ~monitor_query_client.models.ErrorDetails
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[Table]'},
+ 'errors': {'key': 'errors', 'type': 'ErrorDetails'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(QueryResults, self).__init__(**kwargs)
+ self.tables = kwargs.get('tables', None)
+ self.errors = kwargs.get('errors', None)
+
+
+class Response(msrest.serialization.Model):
+ """The response to a metrics query.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param cost: The integer value representing the cost of the query, for data case.
+ :type cost: int
+ :param timespan: Required. The timespan for which the data was retrieved. Its value consists of
+ two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned
+ back from what was originally requested.
+ :type timespan: str
+ :param interval: The interval (window size) for which the metric data was returned in. This
+ may be adjusted in the future and returned back from what was originally requested. This is
+ not present if a metadata request was made.
+ :type interval: ~datetime.timedelta
+ :param namespace: The namespace of the metrics been queried.
+ :type namespace: str
+ :param resourceregion: The region of the resource been queried for metrics.
+ :type resourceregion: str
+ :param value: Required. the value of the collection.
+ :type value: list[~monitor_query_client.models.Metric]
+ """
+
+ _validation = {
+ 'cost': {'minimum': 0},
+ 'timespan': {'required': True},
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'cost': {'key': 'cost', 'type': 'int'},
+ 'timespan': {'key': 'timespan', 'type': 'str'},
+ 'interval': {'key': 'interval', 'type': 'duration'},
+ 'namespace': {'key': 'namespace', 'type': 'str'},
+ 'resourceregion': {'key': 'resourceregion', 'type': 'str'},
+ 'value': {'key': 'value', 'type': '[Metric]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(Response, self).__init__(**kwargs)
+ self.cost = kwargs.get('cost', None)
+ self.timespan = kwargs['timespan']
+ self.interval = kwargs.get('interval', None)
+ self.namespace = kwargs.get('namespace', None)
+ self.resourceregion = kwargs.get('resourceregion', None)
+ self.value = kwargs['value']
+
+
+class Table(msrest.serialization.Model):
+ """Contains the columns and rows for one table in a query response.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param name: Required. The name of the table.
+ :type name: str
+ :param columns: Required. The list of columns in this table.
+ :type columns: list[~monitor_query_client.models.Column]
+ :param rows: Required. The resulting rows from this query.
+ :type rows: list[list[str]]
+ """
+
+ _validation = {
+ 'name': {'required': True},
+ 'columns': {'required': True},
+ 'rows': {'required': True},
+ }
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'str'},
+ 'columns': {'key': 'columns', 'type': '[Column]'},
+ 'rows': {'key': 'rows', 'type': '[[str]]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(Table, self).__init__(**kwargs)
+ self.name = kwargs['name']
+ self.columns = kwargs['columns']
+ self.rows = kwargs['rows']
+
+
+class TimeSeriesElement(msrest.serialization.Model):
+ """A time series result type. The discriminator value is always TimeSeries in this case.
+
+ :param metadatavalues: the metadata values returned if $filter was specified in the call.
+ :type metadatavalues: list[~monitor_query_client.models.MetadataValue]
+ :param data: An array of data points representing the metric values. This is only returned if
+ a result type of data is specified.
+ :type data: list[~monitor_query_client.models.MetricValue]
+ """
+
+ _attribute_map = {
+ 'metadatavalues': {'key': 'metadatavalues', 'type': '[MetadataValue]'},
+ 'data': {'key': 'data', 'type': '[MetricValue]'},
+ }
+
+ def __init__(
+ self,
+ **kwargs
+ ):
+ super(TimeSeriesElement, self).__init__(**kwargs)
+ self.metadatavalues = kwargs.get('metadatavalues', None)
+ self.data = kwargs.get('data', None)
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_models_py3.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_models_py3.py
new file mode 100644
index 000000000000..476ee2cd0cfb
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_models_py3.py
@@ -0,0 +1,2055 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+
+import datetime
+from typing import Dict, List, Optional, Union
+
+from azure.core.exceptions import HttpResponseError
+import msrest.serialization
+
+from ._monitor_query_client_enums import *
+
+
+class BatchRequest(msrest.serialization.Model):
+ """An array of requests.
+
+ :param requests: An single request in a batch.
+ :type requests: list[~monitor_query_client.models.LogQueryRequest]
+ """
+
+ _attribute_map = {
+ 'requests': {'key': 'requests', 'type': '[LogQueryRequest]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ requests: Optional[List["LogQueryRequest"]] = None,
+ **kwargs
+ ):
+ super(BatchRequest, self).__init__(**kwargs)
+ self.requests = requests
+
+
+class BatchResponse(msrest.serialization.Model):
+ """Response to a batch.
+
+ :param responses: An array of responses corresponding to each individual request in a batch.
+ :type responses: list[~monitor_query_client.models.LogQueryResponse]
+ :param error: Error response for a batch request.
+ :type error: ~monitor_query_client.models.BatchResponseError
+ """
+
+ _attribute_map = {
+ 'responses': {'key': 'responses', 'type': '[LogQueryResponse]'},
+ 'error': {'key': 'error', 'type': 'BatchResponseError'},
+ }
+
+ def __init__(
+ self,
+ *,
+ responses: Optional[List["LogQueryResponse"]] = None,
+ error: Optional["BatchResponseError"] = None,
+ **kwargs
+ ):
+ super(BatchResponse, self).__init__(**kwargs)
+ self.responses = responses
+ self.error = error
+
+
+class BatchResponseError(msrest.serialization.Model):
+ """Error response for a batch request.
+
+ :param message: The error message describing the cause of the error.
+ :type message: str
+ :param code: The error code.
+ :type code: str
+ :param inner_error:
+ :type inner_error: ~monitor_query_client.models.BatchResponseErrorInnerError
+ """
+
+ _attribute_map = {
+ 'message': {'key': 'message', 'type': 'str'},
+ 'code': {'key': 'code', 'type': 'str'},
+ 'inner_error': {'key': 'innerError', 'type': 'BatchResponseErrorInnerError'},
+ }
+
+ def __init__(
+ self,
+ *,
+ message: Optional[str] = None,
+ code: Optional[str] = None,
+ inner_error: Optional["BatchResponseErrorInnerError"] = None,
+ **kwargs
+ ):
+ super(BatchResponseError, self).__init__(**kwargs)
+ self.message = message
+ self.code = code
+ self.inner_error = inner_error
+
+
+class BatchResponseErrorInnerError(msrest.serialization.Model):
+ """BatchResponseErrorInnerError.
+
+ :param code:
+ :type code: str
+ :param message:
+ :type message: str
+ :param details:
+ :type details: list[~monitor_query_client.models.ErrorDetails]
+ """
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'details': {'key': 'details', 'type': '[ErrorDetails]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ code: Optional[str] = None,
+ message: Optional[str] = None,
+ details: Optional[List["ErrorDetails"]] = None,
+ **kwargs
+ ):
+ super(BatchResponseErrorInnerError, self).__init__(**kwargs)
+ self.code = code
+ self.message = message
+ self.details = details
+
+
+class Column(msrest.serialization.Model):
+ """A column in a table.
+
+ :param name: The name of this column.
+ :type name: str
+ :param type: The data type of this column.
+ :type type: str
+ """
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ name: Optional[str] = None,
+ type: Optional[str] = None,
+ **kwargs
+ ):
+ super(Column, self).__init__(**kwargs)
+ self.name = name
+ self.type = type
+
+
+class ErrorDetail(msrest.serialization.Model):
+ """Error details.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param code: Required. The error's code.
+ :type code: str
+ :param message: Required. A human readable error message.
+ :type message: str
+ :param target: Indicates which property in the request is responsible for the error.
+ :type target: str
+ :param value: Indicates which value in 'target' is responsible for the error.
+ :type value: str
+ :param resources: Indicates resources which were responsible for the error.
+ :type resources: list[str]
+ :param additional_properties: Additional properties that can be provided on the error details
+ object.
+ :type additional_properties: object
+ """
+
+ _validation = {
+ 'code': {'required': True},
+ 'message': {'required': True},
+ }
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'target': {'key': 'target', 'type': 'str'},
+ 'value': {'key': 'value', 'type': 'str'},
+ 'resources': {'key': 'resources', 'type': '[str]'},
+ 'additional_properties': {'key': 'additionalProperties', 'type': 'object'},
+ }
+
+ def __init__(
+ self,
+ *,
+ code: str,
+ message: str,
+ target: Optional[str] = None,
+ value: Optional[str] = None,
+ resources: Optional[List[str]] = None,
+ additional_properties: Optional[object] = None,
+ **kwargs
+ ):
+ super(ErrorDetail, self).__init__(**kwargs)
+ self.code = code
+ self.message = message
+ self.target = target
+ self.value = value
+ self.resources = resources
+ self.additional_properties = additional_properties
+
+
+class ErrorDetails(msrest.serialization.Model):
+ """ErrorDetails.
+
+ :param code:
+ :type code: str
+ :param message:
+ :type message: str
+ :param target:
+ :type target: str
+ """
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'target': {'key': 'target', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ code: Optional[str] = None,
+ message: Optional[str] = None,
+ target: Optional[str] = None,
+ **kwargs
+ ):
+ super(ErrorDetails, self).__init__(**kwargs)
+ self.code = code
+ self.message = message
+ self.target = target
+
+
+class ErrorInfo(msrest.serialization.Model):
+ """The code and message for an error.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param code: Required. A machine readable error code.
+ :type code: str
+ :param message: Required. A human readable error message.
+ :type message: str
+ :param details: error details.
+ :type details: list[~monitor_query_client.models.ErrorDetail]
+ :param innererror: Inner error details if they exist.
+ :type innererror: ~monitor_query_client.models.ErrorInfo
+ :param additional_properties: Additional properties that can be provided on the error info
+ object.
+ :type additional_properties: object
+ """
+
+ _validation = {
+ 'code': {'required': True},
+ 'message': {'required': True},
+ }
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ 'details': {'key': 'details', 'type': '[ErrorDetail]'},
+ 'innererror': {'key': 'innererror', 'type': 'ErrorInfo'},
+ 'additional_properties': {'key': 'additionalProperties', 'type': 'object'},
+ }
+
+ def __init__(
+ self,
+ *,
+ code: str,
+ message: str,
+ details: Optional[List["ErrorDetail"]] = None,
+ innererror: Optional["ErrorInfo"] = None,
+ additional_properties: Optional[object] = None,
+ **kwargs
+ ):
+ super(ErrorInfo, self).__init__(**kwargs)
+ self.code = code
+ self.message = message
+ self.details = details
+ self.innererror = innererror
+ self.additional_properties = additional_properties
+
+
+class ErrorResponse(msrest.serialization.Model):
+ """Contains details when the response code indicates an error.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param error: Required. The error details.
+ :type error: ~monitor_query_client.models.ErrorInfo
+ """
+
+ _validation = {
+ 'error': {'required': True},
+ }
+
+ _attribute_map = {
+ 'error': {'key': 'error', 'type': 'ErrorInfo'},
+ }
+
+ def __init__(
+ self,
+ *,
+ error: "ErrorInfo",
+ **kwargs
+ ):
+ super(ErrorResponse, self).__init__(**kwargs)
+ self.error = error
+
+
+class ErrorResponseAutoGenerated(msrest.serialization.Model):
+ """Describes the format of Error response.
+
+ :param code: Error code.
+ :type code: str
+ :param message: Error message indicating why the operation failed.
+ :type message: str
+ """
+
+ _attribute_map = {
+ 'code': {'key': 'code', 'type': 'str'},
+ 'message': {'key': 'message', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ code: Optional[str] = None,
+ message: Optional[str] = None,
+ **kwargs
+ ):
+ super(ErrorResponseAutoGenerated, self).__init__(**kwargs)
+ self.code = code
+ self.message = message
+
+
+class LocalizableString(msrest.serialization.Model):
+ """The localizable string class.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param value: Required. the invariant value.
+ :type value: str
+ :param localized_value: the locale specific value.
+ :type localized_value: str
+ """
+
+ _validation = {
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'value': {'key': 'value', 'type': 'str'},
+ 'localized_value': {'key': 'localizedValue', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: str,
+ localized_value: Optional[str] = None,
+ **kwargs
+ ):
+ super(LocalizableString, self).__init__(**kwargs)
+ self.value = value
+ self.localized_value = localized_value
+
+
+class LogQueryRequest(msrest.serialization.Model):
+ """An single request in a batch.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :param id: The error details.
+ :type id: str
+ :param headers: Dictionary of :code:``.
+ :type headers: dict[str, str]
+ :param body: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :type body: ~monitor_query_client.models.QueryBody
+ :ivar path: Default value: "/query".
+ :vartype path: str
+ :ivar method: Default value: "POST".
+ :vartype method: str
+ :param workspace: Workspace Id to be included in the query.
+ :type workspace: str
+ """
+
+ _validation = {
+ 'path': {'constant': True},
+ 'method': {'constant': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'headers': {'key': 'headers', 'type': '{str}'},
+ 'body': {'key': 'body', 'type': 'QueryBody'},
+ 'path': {'key': 'path', 'type': 'str'},
+ 'method': {'key': 'method', 'type': 'str'},
+ 'workspace': {'key': 'workspace', 'type': 'str'},
+ }
+
+ path = "/query"
+ method = "POST"
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ headers: Optional[Dict[str, str]] = None,
+ body: Optional["QueryBody"] = None,
+ workspace: Optional[str] = None,
+ **kwargs
+ ):
+ super(LogQueryRequest, self).__init__(**kwargs)
+ self.id = id
+ self.headers = headers
+ self.body = body
+ self.workspace = workspace
+
+
+class LogQueryResponse(msrest.serialization.Model):
+ """LogQueryResponse.
+
+ :param id:
+ :type id: str
+ :param status:
+ :type status: int
+ :param body: Contains the tables, columns & rows resulting from a query.
+ :type body: ~monitor_query_client.models.QueryResults
+ """
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'status': {'key': 'status', 'type': 'int'},
+ 'body': {'key': 'body', 'type': 'QueryResults'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ status: Optional[int] = None,
+ body: Optional["QueryResults"] = None,
+ **kwargs
+ ):
+ super(LogQueryResponse, self).__init__(**kwargs)
+ self.id = id
+ self.status = status
+ self.body = body
+
+
+class MetadataApplication(msrest.serialization.Model):
+ """Application Insights apps that were part of the metadata request and that the user has access to.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the Application Insights app.
+ :type id: str
+ :param resource_id: Required. The ARM resource ID of the Application Insights app.
+ :type resource_id: str
+ :param name: Required. The name of the Application Insights app.
+ :type name: str
+ :param region: Required. The Azure region of the Application Insights app.
+ :type region: str
+ :param related: The related metadata items for the Application Insights app.
+ :type related: ~monitor_query_client.models.MetadataApplicationRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'resource_id': {'required': True},
+ 'name': {'required': True},
+ 'region': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'region': {'key': 'region', 'type': 'str'},
+ 'related': {'key': 'related', 'type': 'MetadataApplicationRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ resource_id: str,
+ name: str,
+ region: str,
+ related: Optional["MetadataApplicationRelated"] = None,
+ **kwargs
+ ):
+ super(MetadataApplication, self).__init__(**kwargs)
+ self.id = id
+ self.resource_id = resource_id
+ self.name = name
+ self.region = region
+ self.related = related
+
+
+class MetadataApplicationRelated(msrest.serialization.Model):
+ """The related metadata items for the Application Insights app.
+
+ :param tables: The related tables for the Application Insights app.
+ :type tables: list[str]
+ :param functions: The related functions for the Application Insights app.
+ :type functions: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ tables: Optional[List[str]] = None,
+ functions: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataApplicationRelated, self).__init__(**kwargs)
+ self.tables = tables
+ self.functions = functions
+
+
+class MetadataCategory(msrest.serialization.Model):
+ """Categories are used to group other metadata entities.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the category.
+ :type id: str
+ :param display_name: Required. The display name of the category.
+ :type display_name: str
+ :param description: The description of the category.
+ :type description: str
+ :param related: The related metadata items for the category.
+ :type related: ~monitor_query_client.models.MetadataCategoryRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'display_name': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'related': {'key': 'related', 'type': 'MetadataCategoryRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ display_name: str,
+ description: Optional[str] = None,
+ related: Optional["MetadataCategoryRelated"] = None,
+ **kwargs
+ ):
+ super(MetadataCategory, self).__init__(**kwargs)
+ self.id = id
+ self.display_name = display_name
+ self.description = description
+ self.related = related
+
+
+class MetadataCategoryRelated(msrest.serialization.Model):
+ """The related metadata items for the category.
+
+ :param tables: The tables related to the category.
+ :type tables: list[str]
+ :param functions: The functions related to the category.
+ :type functions: list[str]
+ :param resource_types: The resource types related to the category.
+ :type resource_types: list[str]
+ :param queries: The saved queries related to the category.
+ :type queries: list[str]
+ :param solutions: The Log Analytics solutions related to the category.
+ :type solutions: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ tables: Optional[List[str]] = None,
+ functions: Optional[List[str]] = None,
+ resource_types: Optional[List[str]] = None,
+ queries: Optional[List[str]] = None,
+ solutions: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataCategoryRelated, self).__init__(**kwargs)
+ self.tables = tables
+ self.functions = functions
+ self.resource_types = resource_types
+ self.queries = queries
+ self.solutions = solutions
+
+
+class MetadataFunction(msrest.serialization.Model):
+ """Functions are stored Kusto queries that can be specified as part of queries by using their name.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the function.
+ :type id: str
+ :param name: Required. The name of the function, to be used in queries.
+ :type name: str
+ :param parameters: The parameters/arguments of the function, if any.
+ :type parameters: str
+ :param display_name: The display name of the function.
+ :type display_name: str
+ :param description: The description of the function.
+ :type description: str
+ :param body: Required. The KQL body of the function.
+ :type body: str
+ :param tags: A set of tags. The tags associated with the function.
+ :type tags: object
+ :param properties: The properties of the function.
+ :type properties: object
+ :param related: The related metadata items for the function.
+ :type related: ~monitor_query_client.models.MetadataFunctionRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'name': {'required': True},
+ 'body': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'parameters': {'key': 'parameters', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'body': {'key': 'body', 'type': 'str'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataFunctionRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ name: str,
+ body: str,
+ parameters: Optional[str] = None,
+ display_name: Optional[str] = None,
+ description: Optional[str] = None,
+ tags: Optional[object] = None,
+ properties: Optional[object] = None,
+ related: Optional["MetadataFunctionRelated"] = None,
+ **kwargs
+ ):
+ super(MetadataFunction, self).__init__(**kwargs)
+ self.id = id
+ self.name = name
+ self.parameters = parameters
+ self.display_name = display_name
+ self.description = description
+ self.body = body
+ self.tags = tags
+ self.properties = properties
+ self.related = related
+
+
+class MetadataFunctionRelated(msrest.serialization.Model):
+ """The related metadata items for the function.
+
+ :param tables: The related tables for the function.
+ :type tables: list[str]
+ :param solutions: The related Log Analytics solutions for the function.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the function.
+ :type resource_types: list[str]
+ :param categories: The related categories for the function.
+ :type categories: list[str]
+ :param workspaces: The related workspaces for the function.
+ :type workspaces: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ tables: Optional[List[str]] = None,
+ solutions: Optional[List[str]] = None,
+ resource_types: Optional[List[str]] = None,
+ categories: Optional[List[str]] = None,
+ workspaces: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataFunctionRelated, self).__init__(**kwargs)
+ self.tables = tables
+ self.solutions = solutions
+ self.resource_types = resource_types
+ self.categories = categories
+ self.workspaces = workspaces
+
+
+class MetadataPermissions(msrest.serialization.Model):
+ """Permission information for the metadata call, includes apps/workspaces/resource the user didn't have access to.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param workspaces: Required. The permission indication for the workspaces on the metadata
+ request.
+ :type workspaces: list[~monitor_query_client.models.MetadataPermissionsWorkspacesItem]
+ :param resources: The permission indication for the Azure resources on the metadata request.
+ :type resources: list[~monitor_query_client.models.MetadataPermissionsResourcesItem]
+ :param applications: The permission indication for the Application Insights apps on the
+ metadata request.
+ :type applications: list[~monitor_query_client.models.MetadataPermissionsApplicationsItem]
+ """
+
+ _validation = {
+ 'workspaces': {'required': True},
+ }
+
+ _attribute_map = {
+ 'workspaces': {'key': 'workspaces', 'type': '[MetadataPermissionsWorkspacesItem]'},
+ 'resources': {'key': 'resources', 'type': '[MetadataPermissionsResourcesItem]'},
+ 'applications': {'key': 'applications', 'type': '[MetadataPermissionsApplicationsItem]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ workspaces: List["MetadataPermissionsWorkspacesItem"],
+ resources: Optional[List["MetadataPermissionsResourcesItem"]] = None,
+ applications: Optional[List["MetadataPermissionsApplicationsItem"]] = None,
+ **kwargs
+ ):
+ super(MetadataPermissions, self).__init__(**kwargs)
+ self.workspaces = workspaces
+ self.resources = resources
+ self.applications = applications
+
+
+class MetadataPermissionsApplicationsItem(msrest.serialization.Model):
+ """MetadataPermissionsApplicationsItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param resource_id: Required. The resource ID on the permission indication.
+ :type resource_id: str
+ """
+
+ _validation = {
+ 'resource_id': {'required': True},
+ }
+
+ _attribute_map = {
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ resource_id: str,
+ **kwargs
+ ):
+ super(MetadataPermissionsApplicationsItem, self).__init__(**kwargs)
+ self.resource_id = resource_id
+
+
+class MetadataPermissionsResourcesItem(msrest.serialization.Model):
+ """MetadataPermissionsResourcesItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param resource_id: Required. The resource ID on the permission indication.
+ :type resource_id: str
+ :param deny_tables: The list of tables that were denied access for the resource ID.
+ :type deny_tables: list[str]
+ """
+
+ _validation = {
+ 'resource_id': {'required': True},
+ }
+
+ _attribute_map = {
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'deny_tables': {'key': 'denyTables', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ resource_id: str,
+ deny_tables: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataPermissionsResourcesItem, self).__init__(**kwargs)
+ self.resource_id = resource_id
+ self.deny_tables = deny_tables
+
+
+class MetadataPermissionsWorkspacesItem(msrest.serialization.Model):
+ """MetadataPermissionsWorkspacesItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param resource_id: Required. The resource ID on the permission indication.
+ :type resource_id: str
+ :param deny_tables: The list of tables that were denied access for the resource ID.
+ :type deny_tables: list[str]
+ """
+
+ _validation = {
+ 'resource_id': {'required': True},
+ }
+
+ _attribute_map = {
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'deny_tables': {'key': 'denyTables', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ resource_id: str,
+ deny_tables: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataPermissionsWorkspacesItem, self).__init__(**kwargs)
+ self.resource_id = resource_id
+ self.deny_tables = deny_tables
+
+
+class MetadataQuery(msrest.serialization.Model):
+ """Queries are stored pieces of KQL, along with a list of relevant metadata items.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the query.
+ :type id: str
+ :param display_name: The display name of the query.
+ :type display_name: str
+ :param description: The description of the query.
+ :type description: str
+ :param body: Required. The KQL body of the query.
+ :type body: str
+ :param labels: The user defined labels associated with the query.
+ :type labels: list[str]
+ :param tags: A set of tags. The tags associated with the query.
+ :type tags: object
+ :param properties: The properties of the query.
+ :type properties: object
+ :param related: The related metadata items for the query.
+ :type related: ~monitor_query_client.models.MetadataQueryRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'body': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'body': {'key': 'body', 'type': 'str'},
+ 'labels': {'key': 'labels', 'type': '[str]'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataQueryRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ body: str,
+ display_name: Optional[str] = None,
+ description: Optional[str] = None,
+ labels: Optional[List[str]] = None,
+ tags: Optional[object] = None,
+ properties: Optional[object] = None,
+ related: Optional["MetadataQueryRelated"] = None,
+ **kwargs
+ ):
+ super(MetadataQuery, self).__init__(**kwargs)
+ self.id = id
+ self.display_name = display_name
+ self.description = description
+ self.body = body
+ self.labels = labels
+ self.tags = tags
+ self.properties = properties
+ self.related = related
+
+
+class MetadataQueryRelated(msrest.serialization.Model):
+ """The related metadata items for the query.
+
+ :param categories: The related categories for the query.
+ :type categories: list[str]
+ :param solutions: The related Log Analytics solutions for the query.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the query.
+ :type resource_types: list[str]
+ :param tables: The related tables for the query.
+ :type tables: list[str]
+ """
+
+ _attribute_map = {
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ categories: Optional[List[str]] = None,
+ solutions: Optional[List[str]] = None,
+ resource_types: Optional[List[str]] = None,
+ tables: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataQueryRelated, self).__init__(**kwargs)
+ self.categories = categories
+ self.solutions = solutions
+ self.resource_types = resource_types
+ self.tables = tables
+
+
+class MetadataResourceType(msrest.serialization.Model):
+ """Metadata about types of Azure resources, containing relevant tables, functions, etc.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the resource-type.
+ :type id: str
+ :param type: Required. The type of the resource-type.
+ :type type: str
+ :param display_name: The display name of the resource-type.
+ :type display_name: str
+ :param description: The description of the resource-type.
+ :type description: str
+ :param labels: The user-defined labels of the resource-type.
+ :type labels: list[str]
+ :param tags: A set of tags. The tags associated with the resource-type.
+ :type tags: object
+ :param properties: The properties of the resource-type.
+ :type properties: object
+ :param related: The related metadata items for the resource-type.
+ :type related: ~monitor_query_client.models.MetadataResourceTypeRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'type': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'labels': {'key': 'labels', 'type': '[str]'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataResourceTypeRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ type: str,
+ display_name: Optional[str] = None,
+ description: Optional[str] = None,
+ labels: Optional[List[str]] = None,
+ tags: Optional[object] = None,
+ properties: Optional[object] = None,
+ related: Optional["MetadataResourceTypeRelated"] = None,
+ **kwargs
+ ):
+ super(MetadataResourceType, self).__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.display_name = display_name
+ self.description = description
+ self.labels = labels
+ self.tags = tags
+ self.properties = properties
+ self.related = related
+
+
+class MetadataResourceTypeRelated(msrest.serialization.Model):
+ """The related metadata items for the resource-type.
+
+ :param tables: The tables related to the resource-type.
+ :type tables: list[str]
+ :param functions: The functions related to the resource-type.
+ :type functions: list[str]
+ :param categories: The categories related to the resource-type.
+ :type categories: list[str]
+ :param queries: The queries related to the resource-type.
+ :type queries: list[str]
+ :param workspaces: The Log Analytics workspaces related to the resource-type.
+ :type workspaces: list[str]
+ :param resources: The Azure resources related to the resource-type.
+ :type resources: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ 'resources': {'key': 'resources', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ tables: Optional[List[str]] = None,
+ functions: Optional[List[str]] = None,
+ categories: Optional[List[str]] = None,
+ queries: Optional[List[str]] = None,
+ workspaces: Optional[List[str]] = None,
+ resources: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataResourceTypeRelated, self).__init__(**kwargs)
+ self.tables = tables
+ self.functions = functions
+ self.categories = categories
+ self.queries = queries
+ self.workspaces = workspaces
+ self.resources = resources
+
+
+class MetadataResults(msrest.serialization.Model):
+ """The metadata response for the app, including available tables, etc.
+
+ :param categories: The list of categories that are referenced in this metadata response.
+ :type categories: list[~monitor_query_client.models.MetadataCategory]
+ :param resource_types: The list of resource types that are referenced in this metadata
+ response.
+ :type resource_types: list[~monitor_query_client.models.MetadataResourceType]
+ :param solutions: The list of Log Analytics solutions installed on the workspace.
+ :type solutions: list[~monitor_query_client.models.MetadataSolution]
+ :param tables: The list of tables and columns that comprise the schema of the workspace.
+ :type tables: list[~monitor_query_client.models.MetadataTable]
+ :param functions: The list of functions stored on the workspace, or introduced by solutions
+ etc.
+ :type functions: list[~monitor_query_client.models.MetadataFunction]
+ :param queries: The list of saved queries stored on the workspace, or introduced by solutions,
+ resource types, etc.
+ :type queries: list[~monitor_query_client.models.MetadataQuery]
+ :param applications: The list of Application Insights apps that were referenced in the metadata
+ request.
+ :type applications: list[~monitor_query_client.models.MetadataApplication]
+ :param workspaces: The list of Log Analytics workspaces that were referenced in the metadata
+ request.
+ :type workspaces: list[~monitor_query_client.models.MetadataWorkspace]
+ :param resources: The list of Azure resources that were referenced in the metadata request.
+ :type resources: list[object]
+ :param permissions: The list of permission rules that affected the metadata request.
+ :type permissions: list[~monitor_query_client.models.MetadataPermissions]
+ """
+
+ _validation = {
+ 'categories': {'unique': True},
+ 'resource_types': {'unique': True},
+ 'solutions': {'unique': True},
+ 'tables': {'unique': True},
+ 'functions': {'unique': True},
+ 'queries': {'unique': True},
+ 'applications': {'unique': True},
+ 'workspaces': {'unique': True},
+ 'resources': {'unique': True},
+ 'permissions': {'unique': True},
+ }
+
+ _attribute_map = {
+ 'categories': {'key': 'categories', 'type': '[MetadataCategory]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[MetadataResourceType]'},
+ 'solutions': {'key': 'solutions', 'type': '[MetadataSolution]'},
+ 'tables': {'key': 'tables', 'type': '[MetadataTable]'},
+ 'functions': {'key': 'functions', 'type': '[MetadataFunction]'},
+ 'queries': {'key': 'queries', 'type': '[MetadataQuery]'},
+ 'applications': {'key': 'applications', 'type': '[MetadataApplication]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[MetadataWorkspace]'},
+ 'resources': {'key': 'resources', 'type': '[object]'},
+ 'permissions': {'key': 'permissions', 'type': '[MetadataPermissions]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ categories: Optional[List["MetadataCategory"]] = None,
+ resource_types: Optional[List["MetadataResourceType"]] = None,
+ solutions: Optional[List["MetadataSolution"]] = None,
+ tables: Optional[List["MetadataTable"]] = None,
+ functions: Optional[List["MetadataFunction"]] = None,
+ queries: Optional[List["MetadataQuery"]] = None,
+ applications: Optional[List["MetadataApplication"]] = None,
+ workspaces: Optional[List["MetadataWorkspace"]] = None,
+ resources: Optional[List[object]] = None,
+ permissions: Optional[List["MetadataPermissions"]] = None,
+ **kwargs
+ ):
+ super(MetadataResults, self).__init__(**kwargs)
+ self.categories = categories
+ self.resource_types = resource_types
+ self.solutions = solutions
+ self.tables = tables
+ self.functions = functions
+ self.queries = queries
+ self.applications = applications
+ self.workspaces = workspaces
+ self.resources = resources
+ self.permissions = permissions
+
+
+class MetadataSolution(msrest.serialization.Model):
+ """Solutions can group tables and functions that are associated with a certain Azure Log Analytics offering.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the Log Analytics solution.
+ :type id: str
+ :param name: Required. The name of the Log Analytics solution.
+ :type name: str
+ :param display_name: The display name of the Log Analytics solution.
+ :type display_name: str
+ :param description: The description of the Log Analytics solution.
+ :type description: str
+ :param tags: A set of tags. The tags that are associated with the Log Analytics solution.
+ :type tags: object
+ :param properties: The properties of the Log Analytics solution.
+ :type properties: object
+ :param related: Required. The related metadata items for the Log Analytics solution.
+ :type related: ~monitor_query_client.models.MetadataSolutionRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'name': {'required': True},
+ 'related': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'display_name': {'key': 'displayName', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'related': {'key': 'related', 'type': 'MetadataSolutionRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ name: str,
+ related: "MetadataSolutionRelated",
+ display_name: Optional[str] = None,
+ description: Optional[str] = None,
+ tags: Optional[object] = None,
+ properties: Optional[object] = None,
+ **kwargs
+ ):
+ super(MetadataSolution, self).__init__(**kwargs)
+ self.id = id
+ self.name = name
+ self.display_name = display_name
+ self.description = description
+ self.tags = tags
+ self.properties = properties
+ self.related = related
+
+
+class MetadataSolutionRelated(msrest.serialization.Model):
+ """The related metadata items for the Log Analytics solution.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param tables: Required. The tables related to the Log Analytics solution.
+ :type tables: list[str]
+ :param functions: The functions related to the Log Analytics solution.
+ :type functions: list[str]
+ :param categories: The categories related to the Log Analytics solution.
+ :type categories: list[str]
+ :param queries: The saved queries related to the Log Analytics solution.
+ :type queries: list[str]
+ :param workspaces: The Workspaces referenced in the metadata request that are related to the
+ Log Analytics solution.
+ :type workspaces: list[str]
+ """
+
+ _validation = {
+ 'tables': {'required': True},
+ }
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ tables: List[str],
+ functions: Optional[List[str]] = None,
+ categories: Optional[List[str]] = None,
+ queries: Optional[List[str]] = None,
+ workspaces: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataSolutionRelated, self).__init__(**kwargs)
+ self.tables = tables
+ self.functions = functions
+ self.categories = categories
+ self.queries = queries
+ self.workspaces = workspaces
+
+
+class MetadataTable(msrest.serialization.Model):
+ """Tables are part of the workspace schema, and contain a list of columns and a reference to other relevant metadata items.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the table.
+ :type id: str
+ :param name: Required. The name of the table.
+ :type name: str
+ :param description: The description of the table.
+ :type description: str
+ :param timespan_column: The column associated with the timespan query parameter for the table.
+ :type timespan_column: str
+ :param labels: The user defined labels of the table.
+ :type labels: list[str]
+ :param tags: A set of tags. The tags associated with the table.
+ :type tags: object
+ :param properties: The properties of the table.
+ :type properties: object
+ :param columns: The list of columns defined on the table.
+ :type columns: list[~monitor_query_client.models.MetadataTableColumnsItem]
+ :param related: The related metadata items for the table.
+ :type related: ~monitor_query_client.models.MetadataTableRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'name': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'timespan_column': {'key': 'timespanColumn', 'type': 'str'},
+ 'labels': {'key': 'labels', 'type': '[str]'},
+ 'tags': {'key': 'tags', 'type': 'object'},
+ 'properties': {'key': 'properties', 'type': 'object'},
+ 'columns': {'key': 'columns', 'type': '[MetadataTableColumnsItem]'},
+ 'related': {'key': 'related', 'type': 'MetadataTableRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ name: str,
+ description: Optional[str] = None,
+ timespan_column: Optional[str] = None,
+ labels: Optional[List[str]] = None,
+ tags: Optional[object] = None,
+ properties: Optional[object] = None,
+ columns: Optional[List["MetadataTableColumnsItem"]] = None,
+ related: Optional["MetadataTableRelated"] = None,
+ **kwargs
+ ):
+ super(MetadataTable, self).__init__(**kwargs)
+ self.id = id
+ self.name = name
+ self.description = description
+ self.timespan_column = timespan_column
+ self.labels = labels
+ self.tags = tags
+ self.properties = properties
+ self.columns = columns
+ self.related = related
+
+
+class MetadataTableColumnsItem(msrest.serialization.Model):
+ """MetadataTableColumnsItem.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param name: Required. The name of the column.
+ :type name: str
+ :param description: The description of the column.
+ :type description: str
+ :param type: Required. The data type of the column. Possible values include: "bool",
+ "datetime", "dynamic", "int", "long", "real", "string".
+ :type type: str or ~monitor_query_client.models.MetadataColumnDataType
+ :param is_preferred_facet: A flag indicating this column is a preferred facet.
+ :type is_preferred_facet: bool
+ :param source: an indication of the source of the column, used only when multiple workspaces
+ have conflicting definition for the column.
+ :type source: object
+ """
+
+ _validation = {
+ 'name': {'required': True},
+ 'type': {'required': True},
+ }
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'str'},
+ 'description': {'key': 'description', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'is_preferred_facet': {'key': 'isPreferredFacet', 'type': 'bool'},
+ 'source': {'key': 'source', 'type': 'object'},
+ }
+
+ def __init__(
+ self,
+ *,
+ name: str,
+ type: Union[str, "MetadataColumnDataType"],
+ description: Optional[str] = None,
+ is_preferred_facet: Optional[bool] = None,
+ source: Optional[object] = None,
+ **kwargs
+ ):
+ super(MetadataTableColumnsItem, self).__init__(**kwargs)
+ self.name = name
+ self.description = description
+ self.type = type
+ self.is_preferred_facet = is_preferred_facet
+ self.source = source
+
+
+class MetadataTableRelated(msrest.serialization.Model):
+ """The related metadata items for the table.
+
+ :param categories: The related categories for the table.
+ :type categories: list[str]
+ :param solutions: The related Log Analytics solutions for the table.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the table.
+ :type resource_types: list[str]
+ :param workspaces: The related Log Analytics workspaces for the table.
+ :type workspaces: list[str]
+ :param functions: The related functions for the table.
+ :type functions: list[str]
+ :param queries: The related saved queries for the table.
+ :type queries: list[str]
+ """
+
+ _attribute_map = {
+ 'categories': {'key': 'categories', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'queries': {'key': 'queries', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ categories: Optional[List[str]] = None,
+ solutions: Optional[List[str]] = None,
+ resource_types: Optional[List[str]] = None,
+ workspaces: Optional[List[str]] = None,
+ functions: Optional[List[str]] = None,
+ queries: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataTableRelated, self).__init__(**kwargs)
+ self.categories = categories
+ self.solutions = solutions
+ self.resource_types = resource_types
+ self.workspaces = workspaces
+ self.functions = functions
+ self.queries = queries
+
+
+class MetadataValue(msrest.serialization.Model):
+ """Represents a metric metadata value.
+
+ :param name: the name of the metadata.
+ :type name: ~monitor_query_client.models.LocalizableString
+ :param value: the value of the metadata.
+ :type value: str
+ """
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'LocalizableString'},
+ 'value': {'key': 'value', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ name: Optional["LocalizableString"] = None,
+ value: Optional[str] = None,
+ **kwargs
+ ):
+ super(MetadataValue, self).__init__(**kwargs)
+ self.name = name
+ self.value = value
+
+
+class MetadataWorkspace(msrest.serialization.Model):
+ """Log Analytics workspaces that were part of the metadata request and that the user has access to.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. The ID of the Log Analytics workspace.
+ :type id: str
+ :param resource_id: Required. The ARM resource ID of the Log Analytics workspace.
+ :type resource_id: str
+ :param name: Required. The name of the Log Analytics workspace.
+ :type name: str
+ :param region: Required. The Azure region of the Log Analytics workspace.
+ :type region: str
+ :param related: The related metadata items for the Log Analytics workspace.
+ :type related: ~monitor_query_client.models.MetadataWorkspaceRelated
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'resource_id': {'required': True},
+ 'name': {'required': True},
+ 'region': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'region': {'key': 'region', 'type': 'str'},
+ 'related': {'key': 'related', 'type': 'MetadataWorkspaceRelated'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ resource_id: str,
+ name: str,
+ region: str,
+ related: Optional["MetadataWorkspaceRelated"] = None,
+ **kwargs
+ ):
+ super(MetadataWorkspace, self).__init__(**kwargs)
+ self.id = id
+ self.resource_id = resource_id
+ self.name = name
+ self.region = region
+ self.related = related
+
+
+class MetadataWorkspaceRelated(msrest.serialization.Model):
+ """The related metadata items for the Log Analytics workspace.
+
+ :param tables: The related tables for the Log Analytics workspace.
+ :type tables: list[str]
+ :param solutions: The related Log Analytics solutions for the Log Analytics workspace.
+ :type solutions: list[str]
+ :param resource_types: The related resource types for the Log Analytics workspace.
+ :type resource_types: list[str]
+ :param functions: The related functions for the Log Analytics workspace.
+ :type functions: list[str]
+ :param resources: The related Azure resources for the Log Analytics workspace.
+ :type resources: list[str]
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[str]'},
+ 'solutions': {'key': 'solutions', 'type': '[str]'},
+ 'resource_types': {'key': 'resourceTypes', 'type': '[str]'},
+ 'functions': {'key': 'functions', 'type': '[str]'},
+ 'resources': {'key': 'resources', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ tables: Optional[List[str]] = None,
+ solutions: Optional[List[str]] = None,
+ resource_types: Optional[List[str]] = None,
+ functions: Optional[List[str]] = None,
+ resources: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(MetadataWorkspaceRelated, self).__init__(**kwargs)
+ self.tables = tables
+ self.solutions = solutions
+ self.resource_types = resource_types
+ self.functions = functions
+ self.resources = resources
+
+
+class Metric(msrest.serialization.Model):
+ """The result data of a query.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param id: Required. the metric Id.
+ :type id: str
+ :param type: Required. the resource type of the metric resource.
+ :type type: str
+ :param name: Required. the name and the display name of the metric, i.e. it is localizable
+ string.
+ :type name: ~monitor_query_client.models.LocalizableString
+ :param unit: Required. the unit of the metric. Possible values include: "Count", "Bytes",
+ "Seconds", "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds",
+ "Unspecified", "Cores", "MilliCores", "NanoCores", "BitsPerSecond".
+ :type unit: str or ~monitor_query_client.models.Unit
+ :param timeseries: Required. the time series returned when a data query is performed.
+ :type timeseries: list[~monitor_query_client.models.TimeSeriesElement]
+ """
+
+ _validation = {
+ 'id': {'required': True},
+ 'type': {'required': True},
+ 'name': {'required': True},
+ 'unit': {'required': True},
+ 'timeseries': {'required': True},
+ }
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'LocalizableString'},
+ 'unit': {'key': 'unit', 'type': 'str'},
+ 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: str,
+ type: str,
+ name: "LocalizableString",
+ unit: Union[str, "Unit"],
+ timeseries: List["TimeSeriesElement"],
+ **kwargs
+ ):
+ super(Metric, self).__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.unit = unit
+ self.timeseries = timeseries
+
+
+class MetricAvailability(msrest.serialization.Model):
+ """Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain.
+
+ :param time_grain: the time grain specifies the aggregation interval for the metric. Expressed
+ as a duration 'PT1M', 'P1D', etc.
+ :type time_grain: ~datetime.timedelta
+ :param retention: the retention period for the metric at the specified timegrain. Expressed as
+ a duration 'PT1M', 'P1D', etc.
+ :type retention: ~datetime.timedelta
+ """
+
+ _attribute_map = {
+ 'time_grain': {'key': 'timeGrain', 'type': 'duration'},
+ 'retention': {'key': 'retention', 'type': 'duration'},
+ }
+
+ def __init__(
+ self,
+ *,
+ time_grain: Optional[datetime.timedelta] = None,
+ retention: Optional[datetime.timedelta] = None,
+ **kwargs
+ ):
+ super(MetricAvailability, self).__init__(**kwargs)
+ self.time_grain = time_grain
+ self.retention = retention
+
+
+class MetricDefinition(msrest.serialization.Model):
+ """Metric definition class specifies the metadata for a metric.
+
+ :param is_dimension_required: Flag to indicate whether the dimension is required.
+ :type is_dimension_required: bool
+ :param resource_id: the resource identifier of the resource that emitted the metric.
+ :type resource_id: str
+ :param namespace: the namespace the metric belongs to.
+ :type namespace: str
+ :param name: the name and the display name of the metric, i.e. it is a localizable string.
+ :type name: ~monitor_query_client.models.LocalizableString
+ :param unit: the unit of the metric. Possible values include: "Count", "Bytes", "Seconds",
+ "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified",
+ "Cores", "MilliCores", "NanoCores", "BitsPerSecond".
+ :type unit: str or ~monitor_query_client.models.Unit
+ :param primary_aggregation_type: the primary aggregation type value defining how to use the
+ values for display. Possible values include: "None", "Average", "Count", "Minimum", "Maximum",
+ "Total".
+ :type primary_aggregation_type: str or ~monitor_query_client.models.AggregationType
+ :param supported_aggregation_types: the collection of what aggregation types are supported.
+ :type supported_aggregation_types: list[str or ~monitor_query_client.models.AggregationType]
+ :param metric_availabilities: the collection of what aggregation intervals are available to be
+ queried.
+ :type metric_availabilities: list[~monitor_query_client.models.MetricAvailability]
+ :param id: the resource identifier of the metric definition.
+ :type id: str
+ :param dimensions: the name and the display name of the dimension, i.e. it is a localizable
+ string.
+ :type dimensions: list[~monitor_query_client.models.LocalizableString]
+ """
+
+ _attribute_map = {
+ 'is_dimension_required': {'key': 'isDimensionRequired', 'type': 'bool'},
+ 'resource_id': {'key': 'resourceId', 'type': 'str'},
+ 'namespace': {'key': 'namespace', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'LocalizableString'},
+ 'unit': {'key': 'unit', 'type': 'str'},
+ 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'},
+ 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'},
+ 'metric_availabilities': {'key': 'metricAvailabilities', 'type': '[MetricAvailability]'},
+ 'id': {'key': 'id', 'type': 'str'},
+ 'dimensions': {'key': 'dimensions', 'type': '[LocalizableString]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ is_dimension_required: Optional[bool] = None,
+ resource_id: Optional[str] = None,
+ namespace: Optional[str] = None,
+ name: Optional["LocalizableString"] = None,
+ unit: Optional[Union[str, "Unit"]] = None,
+ primary_aggregation_type: Optional[Union[str, "AggregationType"]] = None,
+ supported_aggregation_types: Optional[List[Union[str, "AggregationType"]]] = None,
+ metric_availabilities: Optional[List["MetricAvailability"]] = None,
+ id: Optional[str] = None,
+ dimensions: Optional[List["LocalizableString"]] = None,
+ **kwargs
+ ):
+ super(MetricDefinition, self).__init__(**kwargs)
+ self.is_dimension_required = is_dimension_required
+ self.resource_id = resource_id
+ self.namespace = namespace
+ self.name = name
+ self.unit = unit
+ self.primary_aggregation_type = primary_aggregation_type
+ self.supported_aggregation_types = supported_aggregation_types
+ self.metric_availabilities = metric_availabilities
+ self.id = id
+ self.dimensions = dimensions
+
+
+class MetricDefinitionCollection(msrest.serialization.Model):
+ """Represents collection of metric definitions.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param value: Required. the values for the metric definitions.
+ :type value: list[~monitor_query_client.models.MetricDefinition]
+ """
+
+ _validation = {
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'value': {'key': 'value', 'type': '[MetricDefinition]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: List["MetricDefinition"],
+ **kwargs
+ ):
+ super(MetricDefinitionCollection, self).__init__(**kwargs)
+ self.value = value
+
+
+class MetricNamespace(msrest.serialization.Model):
+ """Metric namespace class specifies the metadata for a metric namespace.
+
+ :param id: The ID of the metricNamespace.
+ :type id: str
+ :param type: The type of the namespace.
+ :type type: str
+ :param name: The name of the namespace.
+ :type name: str
+ :param properties: Properties which include the fully qualified namespace name.
+ :type properties: ~monitor_query_client.models.MetricNamespaceName
+ """
+
+ _attribute_map = {
+ 'id': {'key': 'id', 'type': 'str'},
+ 'type': {'key': 'type', 'type': 'str'},
+ 'name': {'key': 'name', 'type': 'str'},
+ 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'},
+ }
+
+ def __init__(
+ self,
+ *,
+ id: Optional[str] = None,
+ type: Optional[str] = None,
+ name: Optional[str] = None,
+ properties: Optional["MetricNamespaceName"] = None,
+ **kwargs
+ ):
+ super(MetricNamespace, self).__init__(**kwargs)
+ self.id = id
+ self.type = type
+ self.name = name
+ self.properties = properties
+
+
+class MetricNamespaceCollection(msrest.serialization.Model):
+ """Represents collection of metric namespaces.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param value: Required. The values for the metric namespaces.
+ :type value: list[~monitor_query_client.models.MetricNamespace]
+ """
+
+ _validation = {
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'value': {'key': 'value', 'type': '[MetricNamespace]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ value: List["MetricNamespace"],
+ **kwargs
+ ):
+ super(MetricNamespaceCollection, self).__init__(**kwargs)
+ self.value = value
+
+
+class MetricNamespaceName(msrest.serialization.Model):
+ """The fully qualified metric namespace name.
+
+ :param metric_namespace_name: The metric namespace name.
+ :type metric_namespace_name: str
+ """
+
+ _attribute_map = {
+ 'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'},
+ }
+
+ def __init__(
+ self,
+ *,
+ metric_namespace_name: Optional[str] = None,
+ **kwargs
+ ):
+ super(MetricNamespaceName, self).__init__(**kwargs)
+ self.metric_namespace_name = metric_namespace_name
+
+
+class MetricValue(msrest.serialization.Model):
+ """Represents a metric value.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param time_stamp: Required. the timestamp for the metric value in ISO 8601 format.
+ :type time_stamp: ~datetime.datetime
+ :param average: the average value in the time range.
+ :type average: float
+ :param minimum: the least value in the time range.
+ :type minimum: float
+ :param maximum: the greatest value in the time range.
+ :type maximum: float
+ :param total: the sum of all of the values in the time range.
+ :type total: float
+ :param count: the number of samples in the time range. Can be used to determine the number of
+ values that contributed to the average value.
+ :type count: float
+ """
+
+ _validation = {
+ 'time_stamp': {'required': True},
+ }
+
+ _attribute_map = {
+ 'time_stamp': {'key': 'timeStamp', 'type': 'iso-8601'},
+ 'average': {'key': 'average', 'type': 'float'},
+ 'minimum': {'key': 'minimum', 'type': 'float'},
+ 'maximum': {'key': 'maximum', 'type': 'float'},
+ 'total': {'key': 'total', 'type': 'float'},
+ 'count': {'key': 'count', 'type': 'float'},
+ }
+
+ def __init__(
+ self,
+ *,
+ time_stamp: datetime.datetime,
+ average: Optional[float] = None,
+ minimum: Optional[float] = None,
+ maximum: Optional[float] = None,
+ total: Optional[float] = None,
+ count: Optional[float] = None,
+ **kwargs
+ ):
+ super(MetricValue, self).__init__(**kwargs)
+ self.time_stamp = time_stamp
+ self.average = average
+ self.minimum = minimum
+ self.maximum = maximum
+ self.total = total
+ self.count = count
+
+
+class QueryBody(msrest.serialization.Model):
+ """The Analytics query. Learn more about the `Analytics query syntax `_.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param query: Required. The query to execute.
+ :type query: str
+ :param timespan: Optional. The timespan over which to query data. This is an ISO8601 time
+ period value. This timespan is applied in addition to any that are specified in the query
+ expression.
+ :type timespan: str
+ :param workspaces: A list of workspaces that are included in the query.
+ :type workspaces: list[str]
+ :param qualified_names: A list of qualified workspace names that are included in the query.
+ :type qualified_names: list[str]
+ :param workspace_ids: A list of workspace IDs that are included in the query.
+ :type workspace_ids: list[str]
+ :param azure_resource_ids: A list of Azure resource IDs that are included in the query.
+ :type azure_resource_ids: list[str]
+ """
+
+ _validation = {
+ 'query': {'required': True},
+ }
+
+ _attribute_map = {
+ 'query': {'key': 'query', 'type': 'str'},
+ 'timespan': {'key': 'timespan', 'type': 'str'},
+ 'workspaces': {'key': 'workspaces', 'type': '[str]'},
+ 'qualified_names': {'key': 'qualifiedNames', 'type': '[str]'},
+ 'workspace_ids': {'key': 'workspaceIds', 'type': '[str]'},
+ 'azure_resource_ids': {'key': 'azureResourceIds', 'type': '[str]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ query: str,
+ timespan: Optional[str] = None,
+ workspaces: Optional[List[str]] = None,
+ qualified_names: Optional[List[str]] = None,
+ workspace_ids: Optional[List[str]] = None,
+ azure_resource_ids: Optional[List[str]] = None,
+ **kwargs
+ ):
+ super(QueryBody, self).__init__(**kwargs)
+ self.query = query
+ self.timespan = timespan
+ self.workspaces = workspaces
+ self.qualified_names = qualified_names
+ self.workspace_ids = workspace_ids
+ self.azure_resource_ids = azure_resource_ids
+
+
+class QueryResults(msrest.serialization.Model):
+ """Contains the tables, columns & rows resulting from a query.
+
+ :param tables: The list of tables, columns and rows.
+ :type tables: list[~monitor_query_client.models.Table]
+ :param errors:
+ :type errors: ~monitor_query_client.models.ErrorDetails
+ """
+
+ _attribute_map = {
+ 'tables': {'key': 'tables', 'type': '[Table]'},
+ 'errors': {'key': 'errors', 'type': 'ErrorDetails'},
+ }
+
+ def __init__(
+ self,
+ *,
+ tables: Optional[List["Table"]] = None,
+ errors: Optional["ErrorDetails"] = None,
+ **kwargs
+ ):
+ super(QueryResults, self).__init__(**kwargs)
+ self.tables = tables
+ self.errors = errors
+
+
+class Response(msrest.serialization.Model):
+ """The response to a metrics query.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param cost: The integer value representing the cost of the query, for data case.
+ :type cost: int
+ :param timespan: Required. The timespan for which the data was retrieved. Its value consists of
+ two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned
+ back from what was originally requested.
+ :type timespan: str
+ :param interval: The interval (window size) for which the metric data was returned in. This
+ may be adjusted in the future and returned back from what was originally requested. This is
+ not present if a metadata request was made.
+ :type interval: ~datetime.timedelta
+ :param namespace: The namespace of the metrics been queried.
+ :type namespace: str
+ :param resourceregion: The region of the resource been queried for metrics.
+ :type resourceregion: str
+ :param value: Required. the value of the collection.
+ :type value: list[~monitor_query_client.models.Metric]
+ """
+
+ _validation = {
+ 'cost': {'minimum': 0},
+ 'timespan': {'required': True},
+ 'value': {'required': True},
+ }
+
+ _attribute_map = {
+ 'cost': {'key': 'cost', 'type': 'int'},
+ 'timespan': {'key': 'timespan', 'type': 'str'},
+ 'interval': {'key': 'interval', 'type': 'duration'},
+ 'namespace': {'key': 'namespace', 'type': 'str'},
+ 'resourceregion': {'key': 'resourceregion', 'type': 'str'},
+ 'value': {'key': 'value', 'type': '[Metric]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ timespan: str,
+ value: List["Metric"],
+ cost: Optional[int] = None,
+ interval: Optional[datetime.timedelta] = None,
+ namespace: Optional[str] = None,
+ resourceregion: Optional[str] = None,
+ **kwargs
+ ):
+ super(Response, self).__init__(**kwargs)
+ self.cost = cost
+ self.timespan = timespan
+ self.interval = interval
+ self.namespace = namespace
+ self.resourceregion = resourceregion
+ self.value = value
+
+
+class Table(msrest.serialization.Model):
+ """Contains the columns and rows for one table in a query response.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param name: Required. The name of the table.
+ :type name: str
+ :param columns: Required. The list of columns in this table.
+ :type columns: list[~monitor_query_client.models.Column]
+ :param rows: Required. The resulting rows from this query.
+ :type rows: list[list[str]]
+ """
+
+ _validation = {
+ 'name': {'required': True},
+ 'columns': {'required': True},
+ 'rows': {'required': True},
+ }
+
+ _attribute_map = {
+ 'name': {'key': 'name', 'type': 'str'},
+ 'columns': {'key': 'columns', 'type': '[Column]'},
+ 'rows': {'key': 'rows', 'type': '[[str]]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ name: str,
+ columns: List["Column"],
+ rows: List[List[str]],
+ **kwargs
+ ):
+ super(Table, self).__init__(**kwargs)
+ self.name = name
+ self.columns = columns
+ self.rows = rows
+
+
+class TimeSeriesElement(msrest.serialization.Model):
+ """A time series result type. The discriminator value is always TimeSeries in this case.
+
+ :param metadatavalues: the metadata values returned if $filter was specified in the call.
+ :type metadatavalues: list[~monitor_query_client.models.MetadataValue]
+ :param data: An array of data points representing the metric values. This is only returned if
+ a result type of data is specified.
+ :type data: list[~monitor_query_client.models.MetricValue]
+ """
+
+ _attribute_map = {
+ 'metadatavalues': {'key': 'metadatavalues', 'type': '[MetadataValue]'},
+ 'data': {'key': 'data', 'type': '[MetricValue]'},
+ }
+
+ def __init__(
+ self,
+ *,
+ metadatavalues: Optional[List["MetadataValue"]] = None,
+ data: Optional[List["MetricValue"]] = None,
+ **kwargs
+ ):
+ super(TimeSeriesElement, self).__init__(**kwargs)
+ self.metadatavalues = metadatavalues
+ self.data = data
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_monitor_query_client_enums.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_monitor_query_client_enums.py
new file mode 100644
index 000000000000..3a0efc9ac6d1
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/models/_monitor_query_client_enums.py
@@ -0,0 +1,73 @@
+# 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 enum import Enum, EnumMeta
+from six import with_metaclass
+
+class _CaseInsensitiveEnumMeta(EnumMeta):
+ def __getitem__(self, name):
+ return super().__getitem__(name.upper())
+
+ def __getattr__(cls, name):
+ """Return the enum member matching `name`
+ We use __getattr__ instead of descriptors or inserting into the enum
+ class' __dict__ in order to support `name` and `value` being both
+ properties for enum members (which live in the class' __dict__) and
+ enum members themselves.
+ """
+ try:
+ return cls._member_map_[name.upper()]
+ except KeyError:
+ raise AttributeError(name)
+
+
+class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+ """the aggregation type of the metric.
+ """
+
+ NONE = "None"
+ AVERAGE = "Average"
+ COUNT = "Count"
+ MINIMUM = "Minimum"
+ MAXIMUM = "Maximum"
+ TOTAL = "Total"
+
+class MetadataColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+ """The data type of the column
+ """
+
+ BOOL = "bool"
+ DATETIME = "datetime"
+ DYNAMIC = "dynamic"
+ INT = "int"
+ LONG = "long"
+ REAL = "real"
+ STRING = "string"
+
+class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+
+ DATA = "Data"
+ METADATA = "Metadata"
+
+class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
+ """the unit of the metric.
+ """
+
+ COUNT = "Count"
+ BYTES = "Bytes"
+ SECONDS = "Seconds"
+ COUNT_PER_SECOND = "CountPerSecond"
+ BYTES_PER_SECOND = "BytesPerSecond"
+ PERCENT = "Percent"
+ MILLI_SECONDS = "MilliSeconds"
+ BYTE_SECONDS = "ByteSeconds"
+ UNSPECIFIED = "Unspecified"
+ CORES = "Cores"
+ MILLI_CORES = "MilliCores"
+ NANO_CORES = "NanoCores"
+ BITS_PER_SECOND = "BitsPerSecond"
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/__init__.py
new file mode 100644
index 000000000000..7c1dc25c27bd
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/__init__.py
@@ -0,0 +1,21 @@
+# 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 ._query_operations import QueryOperations
+from ._metadata_operations import MetadataOperations
+from ._metric_definitions_operations import MetricDefinitionsOperations
+from ._metric_namespaces_operations import MetricNamespacesOperations
+from ._metrics_operations import MetricsOperations
+
+__all__ = [
+ 'QueryOperations',
+ 'MetadataOperations',
+ 'MetricDefinitionsOperations',
+ 'MetricNamespacesOperations',
+ 'MetricsOperations',
+]
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metadata_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metadata_operations.py
new file mode 100644
index 000000000000..f8905b371ffc
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metadata_operations.py
@@ -0,0 +1,158 @@
+# 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 typing import TYPE_CHECKING
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
+
+from .. import models as _models
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+class MetadataOperations(object):
+ """MetadataOperations operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer):
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ def get(
+ self,
+ workspace_id, # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.MetadataResults"
+ """Gets metadata information.
+
+ Retrieve the metadata information for the workspace, including its schema, functions, workspace
+ info, categories etc.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: MetadataResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.MetadataResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/json"
+
+ # Construct URL
+ url = self.get.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('MetadataResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ get.metadata = {'url': '/workspaces/{workspaceId}/metadata'} # type: ignore
+
+ def post(
+ self,
+ workspace_id, # type: str
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.MetadataResults"
+ """Gets metadata information.
+
+ Retrieve the metadata information for the workspace, including its schema, functions, workspace
+ info, categories etc.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: MetadataResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.MetadataResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/json"
+
+ # Construct URL
+ url = self.post.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.post(url, query_parameters, header_parameters)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('MetadataResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ post.metadata = {'url': '/workspaces/{workspaceId}/metadata'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metric_definitions_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metric_definitions_operations.py
new file mode 100644
index 000000000000..a8e009b3aa5c
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metric_definitions_operations.py
@@ -0,0 +1,121 @@
+# 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 typing import TYPE_CHECKING
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
+
+from .. import models as _models
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+class MetricDefinitionsOperations(object):
+ """MetricDefinitionsOperations operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer):
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ def list(
+ self,
+ resource_uri, # type: str
+ metricnamespace=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> Iterable["_models.MetricDefinitionCollection"]
+ """Lists the metric definitions for the resource.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :param metricnamespace: Metric namespace to query metric definitions for.
+ :type metricnamespace: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~monitor_query_client.models.MetricDefinitionCollection]
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricDefinitionCollection"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ api_version = "2018-01-01"
+ accept = "application/json"
+
+ def prepare_request(next_link=None):
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ if not next_link:
+ # Construct URL
+ url = self.list.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
+ if metricnamespace is not None:
+ query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ else:
+ url = next_link
+ query_parameters = {} # type: Dict[str, Any]
+ request = self._client.get(url, query_parameters, header_parameters)
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize('MetricDefinitionCollection', pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem)
+ return None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response)
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ raise HttpResponseError(response=response, model=error)
+
+ return pipeline_response
+
+ return ItemPaged(
+ get_next, extract_data
+ )
+ list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metric_namespaces_operations.py
new file mode 100644
index 000000000000..9df5a0e37f0f
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metric_namespaces_operations.py
@@ -0,0 +1,122 @@
+# 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 typing import TYPE_CHECKING
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.paging import ItemPaged
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
+
+from .. import models as _models
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+class MetricNamespacesOperations(object):
+ """MetricNamespacesOperations operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer):
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ def list(
+ self,
+ resource_uri, # type: str
+ start_time=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> Iterable["_models.MetricNamespaceCollection"]
+ """Lists the metric namespaces for the resource.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :param start_time: The ISO 8601 conform Date start time from which to query for metric
+ namespaces.
+ :type start_time: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: An iterator like instance of either MetricNamespaceCollection or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~monitor_query_client.models.MetricNamespaceCollection]
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.MetricNamespaceCollection"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ api_version = "2017-12-01-preview"
+ accept = "application/json"
+
+ def prepare_request(next_link=None):
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ if not next_link:
+ # Construct URL
+ url = self.list.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
+ if start_time is not None:
+ query_parameters['startTime'] = self._serialize.query("start_time", start_time, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ else:
+ url = next_link
+ query_parameters = {} # type: Dict[str, Any]
+ request = self._client.get(url, query_parameters, header_parameters)
+ return request
+
+ def extract_data(pipeline_response):
+ deserialized = self._deserialize('MetricNamespaceCollection', pipeline_response)
+ list_of_elem = deserialized.value
+ if cls:
+ list_of_elem = cls(list_of_elem)
+ return None, iter(list_of_elem)
+
+ def get_next(next_link=None):
+ request = prepare_request(next_link)
+
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response)
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ raise HttpResponseError(response=response, model=error)
+
+ return pipeline_response
+
+ return ItemPaged(
+ get_next, extract_data
+ )
+ list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricNamespaces'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metrics_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metrics_operations.py
new file mode 100644
index 000000000000..c47b1a859fbd
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_metrics_operations.py
@@ -0,0 +1,159 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import datetime
+from typing import TYPE_CHECKING
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
+
+from .. import models as _models
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+class MetricsOperations(object):
+ """MetricsOperations operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer):
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ def list(
+ self,
+ resource_uri, # type: str
+ timespan=None, # type: Optional[str]
+ interval=None, # type: Optional[datetime.timedelta]
+ metricnames=None, # type: Optional[str]
+ aggregation=None, # type: Optional[str]
+ top=None, # type: Optional[int]
+ orderby=None, # type: Optional[str]
+ filter=None, # type: Optional[str]
+ result_type=None, # type: Optional[Union[str, "_models.ResultType"]]
+ metricnamespace=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.Response"
+ """**Lists the metric values for a resource**.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :param timespan: The timespan of the query. It is a string with the following format
+ 'startDateTime_ISO/endDateTime_ISO'.
+ :type timespan: str
+ :param interval: The interval (i.e. timegrain) of the query.
+ :type interval: ~datetime.timedelta
+ :param metricnames: The names of the metrics (comma separated) to retrieve.
+ :type metricnames: str
+ :param aggregation: The list of aggregation types (comma separated) to retrieve.
+ :type aggregation: str
+ :param top: The maximum number of records to retrieve.
+ Valid only if $filter is specified.
+ Defaults to 10.
+ :type top: int
+ :param orderby: The aggregation to use for sorting results and the direction of the sort.
+ Only one order can be specified.
+ Examples: sum asc.
+ :type orderby: str
+ :param filter: The **$filter** is used to reduce the set of metric data
+ returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`-
+ Return all time series of C where A = a1 and B = b1 or b2:code:`
`\ **$filter=A eq ‘a1’ and
+ B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`
`- Invalid variant::code:`
`\ **$filter=A
+ eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`
`This is invalid because the
+ logical or operator cannot separate two different metadata names.:code:`
`- Return all time
+ series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq
+ ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and
+ B eq ‘\ *’ and C eq ‘*\ ’**.
+ :type filter: str
+ :param result_type: Reduces the set of data collected. The syntax allowed depends on the
+ operation. See the operation's description for details.
+ :type result_type: str or ~monitor_query_client.models.ResultType
+ :param metricnamespace: Metric namespace to query metric definitions for.
+ :type metricnamespace: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: Response, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.Response
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.Response"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ api_version = "2018-01-01"
+ accept = "application/json"
+
+ # Construct URL
+ url = self.list.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ if timespan is not None:
+ query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'str')
+ if interval is not None:
+ query_parameters['interval'] = self._serialize.query("interval", interval, 'duration')
+ if metricnames is not None:
+ query_parameters['metricnames'] = self._serialize.query("metricnames", metricnames, 'str')
+ if aggregation is not None:
+ query_parameters['aggregation'] = self._serialize.query("aggregation", aggregation, 'str')
+ if top is not None:
+ query_parameters['top'] = self._serialize.query("top", top, 'int')
+ if orderby is not None:
+ query_parameters['orderby'] = self._serialize.query("orderby", orderby, 'str')
+ if filter is not None:
+ query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
+ if result_type is not None:
+ query_parameters['resultType'] = self._serialize.query("result_type", result_type, 'str')
+ query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
+ if metricnamespace is not None:
+ query_parameters['metricnamespace'] = self._serialize.query("metricnamespace", metricnamespace, 'str')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('Response', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_query_operations.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_query_operations.py
new file mode 100644
index 000000000000..72d0c7fafe85
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/operations/_query_operations.py
@@ -0,0 +1,242 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import datetime
+from typing import TYPE_CHECKING
+import warnings
+
+from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
+from azure.core.pipeline import PipelineResponse
+from azure.core.pipeline.transport import HttpRequest, HttpResponse
+
+from .. import models as _models
+
+if TYPE_CHECKING:
+ # pylint: disable=unused-import,ungrouped-imports
+ from typing import Any, Callable, Dict, Generic, Optional, TypeVar
+
+ T = TypeVar('T')
+ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
+
+class QueryOperations(object):
+ """QueryOperations operations.
+
+ You should not instantiate this class directly. Instead, you should create a Client instance that
+ instantiates it for you and attaches it as an attribute.
+
+ :ivar models: Alias to model classes used in this operation group.
+ :type models: ~monitor_query_client.models
+ :param client: Client for service requests.
+ :param config: Configuration of service client.
+ :param serializer: An object model serializer.
+ :param deserializer: An object model deserializer.
+ """
+
+ models = _models
+
+ def __init__(self, client, config, serializer, deserializer):
+ self._client = client
+ self._serialize = serializer
+ self._deserialize = deserializer
+ self._config = config
+
+ def get(
+ self,
+ workspace_id, # type: str
+ query, # type: str
+ timespan=None, # type: Optional[datetime.timedelta]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.QueryResults"
+ """Execute an Analytics query.
+
+ Executes an Analytics query for data.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :param query: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :type query: str
+ :param timespan: Optional. The timespan over which to query data. This is an ISO8601 time
+ period value. This timespan is applied in addition to any that are specified in the query
+ expression.
+ :type timespan: ~datetime.timedelta
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: QueryResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.QueryResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ accept = "application/json"
+
+ # Construct URL
+ url = self.get.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+ query_parameters['query'] = self._serialize.query("query", query, 'str')
+ if timespan is not None:
+ query_parameters['timespan'] = self._serialize.query("timespan", timespan, 'duration')
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ request = self._client.get(url, query_parameters, header_parameters)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('QueryResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ get.metadata = {'url': '/workspaces/{workspaceId}/query'} # type: ignore
+
+ def execute(
+ self,
+ workspace_id, # type: str
+ body, # type: "_models.QueryBody"
+ prefer=None, # type: Optional[str]
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.QueryResults"
+ """Execute an Analytics query.
+
+ Executes an Analytics query for data. `Here `_ is an example for using POST with an Analytics query.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :param body: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :type body: ~monitor_query_client.models.QueryBody
+ :param prefer: Optional. The prefer header to set server timeout,.
+ :type prefer: str
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: QueryResults, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.QueryResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.QueryResults"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ content_type = kwargs.pop("content_type", "application/json")
+ accept = "application/json"
+
+ # Construct URL
+ url = self.execute.metadata['url'] # type: ignore
+ path_format_arguments = {
+ 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str'),
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ if prefer is not None:
+ header_parameters['Prefer'] = self._serialize.header("prefer", prefer, 'str')
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(body, 'QueryBody')
+ body_content_kwargs['content'] = body_content
+ request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('QueryResults', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ execute.metadata = {'url': '/workspaces/{workspaceId}/query'} # type: ignore
+
+ def batch(
+ self,
+ body, # type: "_models.BatchRequest"
+ **kwargs # type: Any
+ ):
+ # type: (...) -> "_models.BatchResponse"
+ """Execute a batch of Analytics queries.
+
+ Executes a batch of Analytics queries for data. `Here
+ `_ is an example for using POST with
+ an Analytics query.
+
+ :param body: The batch request body.
+ :type body: ~monitor_query_client.models.BatchRequest
+ :keyword callable cls: A custom type or function that will be passed the direct response
+ :return: BatchResponse, or the result of cls(response)
+ :rtype: ~monitor_query_client.models.BatchResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchResponse"]
+ error_map = {
+ 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
+ }
+ error_map.update(kwargs.pop('error_map', {}))
+ content_type = kwargs.pop("content_type", "application/json")
+ accept = "application/json"
+
+ # Construct URL
+ url = self.batch.metadata['url'] # type: ignore
+
+ # Construct parameters
+ query_parameters = {} # type: Dict[str, Any]
+
+ # Construct headers
+ header_parameters = {} # type: Dict[str, Any]
+ header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
+ header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
+
+ body_content_kwargs = {} # type: Dict[str, Any]
+ body_content = self._serialize.body(body, 'BatchRequest')
+ body_content_kwargs['content'] = body_content
+ request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
+ raise HttpResponseError(response=response, model=error)
+
+ deserialized = self._deserialize('BatchResponse', pipeline_response)
+
+ if cls:
+ return cls(pipeline_response, deserialized, {})
+
+ return deserialized
+ batch.metadata = {'url': '/$batch'} # type: ignore
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/py.typed b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/py.typed
new file mode 100644
index 000000000000..e5aff4f83af8
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_generated/py.typed
@@ -0,0 +1 @@
+# Marker file for PEP 561.
\ No newline at end of file
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py
new file mode 100644
index 000000000000..3a37076d8594
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py
@@ -0,0 +1,22 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+# --------------------------------------------------------------------------
+
+from azure.core.pipeline.policies import BearerTokenCredentialPolicy
+
+def get_authentication_policy(
+ credential, # type: TokenCredential
+):
+ # type: (...) -> BearerTokenCredentialPolicy
+ """Returns the correct authentication policy
+ """
+
+ if credential is None:
+ raise ValueError("Parameter 'credential' must not be None.")
+ if hasattr(credential, "get_token"):
+ return BearerTokenCredentialPolicy(credential, "https://api.loganalytics.io/.default")
+
+ raise TypeError("Unsupported credential")
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_log_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_log_query_client.py
new file mode 100644
index 000000000000..9a38f4b50f80
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_log_query_client.py
@@ -0,0 +1,117 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+# --------------------------------------------------------------------------
+
+from typing import TYPE_CHECKING, Any, Union, Sequence, Dict
+
+from ._generated._monitor_query_client import MonitorQueryClient
+
+from ._generated.models import BatchRequest, QueryBody
+from ._helpers import get_authentication_policy
+from ._models import LogsQueryResults, LogsQueryRequest, LogsQueryBody
+
+if TYPE_CHECKING:
+ from azure.core.credentials import TokenCredential
+ from ._models import LogsBatchResponse
+
+
+class LogsClient(object):
+ """LogsClient
+
+ :param credential: The credential to authenticate the client
+ :type credential: ~azure.core.credentials.TokenCredential
+ """
+
+ def __init__(self, credential, **kwargs):
+ # type: (TokenCredential, Any) -> None
+ self._client = MonitorQueryClient(
+ credential=credential,
+ authentication_policy=get_authentication_policy(credential),
+ **kwargs
+ )
+ self._query_op = self._client.query
+
+ def query(self, workspace_id, query, **kwargs):
+ # type: (str, str, Any) -> LogsQueryResults
+ """Execute an Analytics query.
+
+ Executes an Analytics query for data.
+
+ :param workspace_id: ID of the workspace. This is Workspace ID from the Properties blade in the
+ Azure portal.
+ :type workspace_id: str
+ :param query: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :type query: str
+ :keyword ~datetime.timedelta timespan: Optional. The timespan over which to query data. This is an ISO8601 time
+ period value. This timespan is applied in addition to any that are specified in the query
+ expression.
+ :keyword int server_timeout: the server timeout. The default timeout is 3 minutes,
+ and the maximum timeout is 10 minutes.
+ :keyword bool include_statistics: To get information about query statistics.
+ :keyword bool include_render: In the query language, it is possible to specify different render options.
+ By default, the API does not return information regarding the type of visualization to show.
+ If your client requires this information, specify the preference
+ :return: QueryResults, or the result of cls(response)
+ :rtype: ~azure.monitor.query.LogsQueryResults
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ timespan = kwargs.pop("timespan", None)
+ include_statistics = kwargs.pop("include_statistics", False)
+ include_render = kwargs.pop("include_render", False)
+ timeout = kwargs.pop("server_timeout", None)
+
+ prefer = ""
+ if timeout:
+ prefer += "wait=" + str(timeout)
+ if include_statistics:
+ prefer += " include-statistics=true"
+ if include_render:
+ prefer += " include-render=true"
+
+ if prefer:
+ kwargs.setdefault("prefer", prefer)
+ return self._query_op.execute(
+ workspace_id,
+ LogsQueryBody(query, workspace_ids=[workspace_id]),
+ **kwargs
+ )
+
+ kwargs.setdefault("timespan", timespan)
+ return self._query_op.get(workspace_id, query, **kwargs)
+
+ def batch_query(self, queries, **kwargs):
+ # type: (Union[Sequence[Dict], Sequence[LogsQueryRequest]], Any) -> LogsBatchResponse
+ """Execute an Analytics query.
+
+ Executes an Analytics query for data.
+
+ :param queries: The list of queries that should be processed
+ :type queries: list[dict] or list[~azure.monitor.query.LogsQueryRequest]
+ :return: BatchResponse, or the result of cls(response)
+ :rtype: ~azure.monitor.query.LogsBatchResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ try:
+ queries = [LogsQueryRequest(**q) for q in queries]
+ except (KeyError, TypeError):
+ pass
+ batch = BatchRequest(requests=queries)
+ return self._query_op.batch(batch, **kwargs)
+
+ def close(self):
+ # type: () -> None
+ """Close the :class:`~azure.monitor.query.LogsClient` session."""
+ return self._client.close()
+
+ def __enter__(self):
+ # type: () -> LogsClient
+ self._client.__enter__() # pylint:disable=no-member
+ return self
+
+ def __exit__(self, *args):
+ # type: (*Any) -> None
+ self._client.__exit__(*args) # pylint:disable=no-member
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py
new file mode 100644
index 000000000000..f833c8fdcdd4
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_metrics_query_client.py
@@ -0,0 +1,128 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+# --------------------------------------------------------------------------
+
+# pylint: disable=anomalous-backslash-in-string
+
+from typing import TYPE_CHECKING, Any, Union
+
+from ._generated._monitor_query_client import (
+ MonitorQueryClient,
+)
+
+from ._helpers import get_authentication_policy
+
+if TYPE_CHECKING:
+ from azure.core.credentials import TokenCredential
+ from azure.core.paging import ItemPaged
+ from ._models import MetricsResponse, MetricNamespace, MetricDefinition
+
+
+class MetricsClient(object):
+ """MetricsClient
+
+ :param credential: The credential to authenticate the client
+ :type credential: ~azure.core.credentials.TokenCredential
+ """
+
+ def __init__(self, credential, **kwargs):
+ # type: (TokenCredential, Any) -> None
+ self._client = MonitorQueryClient(
+ credential=credential,
+ authentication_policy=get_authentication_policy(credential),
+ **kwargs
+ )
+ self._metrics_op = self._client.metrics
+ self._namespace_op = self._client.metric_namespaces
+ self._definitions_op = self._client.metric_definitions
+
+ def query(self, resource_uri, metricnames, **kwargs):
+ # type: (str, list, Any) -> MetricsResponse
+ """Lists the metric values for a resource.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :param metricnames: The names of the metrics to retrieve.
+ :type metricnames: list
+ :keyword timespan: The timespan of the query. It is a string with the following format
+ 'startDateTime_ISO/endDateTime_ISO'.
+ :paramtype timespan: str
+ :keyword interval: The interval (i.e. timegrain) of the query.
+ :paramtype interval: ~datetime.timedelta
+ :keyword aggregation: The list of aggregation types (comma separated) to retrieve.
+ :paramtype aggregation: str
+ :keyword top: The maximum number of records to retrieve.
+ Valid only if $filter is specified.
+ Defaults to 10.
+ :paramtype top: int
+ :keyword orderby: The aggregation to use for sorting results and the direction of the sort.
+ Only one order can be specified.
+ Examples: sum asc.
+ :paramtype orderby: str
+ :keyword filter: The **$filter** is used to reduce the set of metric data
+ returned.:code:`
`Example::code:`
`Metric contains metadata A, B and C.:code:`
`-
+ Return all time series of C where A = a1 and B = b1 or b2:code:`
`\ **$filter=A eq ‘a1’ and
+ B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`
`- Invalid variant::code:`
`\ **$filter=A
+ eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`
`This is invalid because the
+ logical or operator cannot separate two different metadata names.:code:`
`- Return all time
+ series where A = a1, B = b1 and C = c1::code:`
`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq
+ ‘c1’**\ :code:`
`- Return all time series where A = a1:code:`
`\ **$filter=A eq ‘a1’ and
+ B eq ‘\ *’ and C eq ‘*\ ’**.
+ :paramtype filter: str
+ :keyword result_type: Reduces the set of data collected. The syntax allowed depends on the
+ operation. See the operation's description for details.
+ :paramtype result_type: str or ~monitor_query_client.models.ResultType
+ :keyword metricnamespace: Metric namespace to query metric definitions for.
+ :paramtype metricnamespace: str
+ :return: Response, or the result of cls(response)
+ :rtype: ~azure.monitor.query.MetricsResponse
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ kwargs.setdefault("metricnames", ",".join(metricnames))
+ return self._metrics_op.list(resource_uri, connection_verify=False, **kwargs)
+
+ def list_metric_namespaces(self, resource_uri, **kwargs):
+ # type: (str, Any) -> ItemPaged[MetricNamespace]
+ """Lists the metric namespaces for the resource.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :keyword start_time: The ISO 8601 conform Date start time from which to query for metric
+ namespaces.
+ :paramtype start_time: str
+ :return: An iterator like instance of either MetricNamespaceCollection or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricNamespace]
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ return self._namespace_op.list(resource_uri)
+
+ def list_metric_definitions(self, resource_uri, **kwargs):
+ # type: (str, Any) -> ItemPaged[MetricDefinition]
+ """Lists the metric definitions for the resource.
+
+ :param resource_uri: The identifier of the resource.
+ :type resource_uri: str
+ :keyword metricnamespace: Metric namespace to query metric definitions for.
+ :paramtype metricnamespace: str
+ :return: An iterator like instance of either MetricDefinitionCollection or the result of cls(response)
+ :rtype: ~azure.core.paging.ItemPaged[~azure.monitor.query.MetricDefinition]
+ :raises: ~azure.core.exceptions.HttpResponseError
+ """
+ return self._namespace_op.list(resource_uri)
+
+ def close(self):
+ # type: () -> None
+ """Close the :class:`~azure.monitor.query.MetricsClient` session."""
+ return self._client.close()
+
+ def __enter__(self):
+ # type: () -> MetricsClient
+ self._client.__enter__() # pylint:disable=no-member
+ return self
+
+ def __exit__(self, *args):
+ # type: (*Any) -> None
+ self._client.__exit__(*args) # pylint:disable=no-member
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py
new file mode 100644
index 000000000000..47f137052fd2
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py
@@ -0,0 +1,247 @@
+#
+# -------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+# --------------------------------------------------------------------------
+
+import uuid
+from typing import Any
+
+from ._generated.models import (
+ QueryResults as InternalQueryResults,
+ Table as InternalTable,
+ Column as InternalColumn,
+ Response as InternalResponse,
+ QueryBody as InternalQueryBody,
+ BatchResponse as InternalBatchResponse,
+ BatchResponseError as InternalBatchResponseError,
+ LogQueryRequest as InternalLogQueryRequest,
+)
+
+
+class LogsQueryResultTable(InternalTable):
+ """Contains the columns and rows for one table in a query response.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :keyword name: Required. The name of the table.
+ :paramtype name: str
+ :keyword columns: Required. The list of columns in this table.
+ :paramtype columns: list[~monitor_query_client.models.Column]
+ :keyword rows: Required. The resulting rows from this query.
+ :paramtype rows: list[list[str]]
+ """
+
+ _validation = {
+ "name": {"required": True},
+ "columns": {"required": True},
+ "rows": {"required": True},
+ }
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "columns": {"key": "columns", "type": "[Column]"},
+ "rows": {"key": "rows", "type": "[[str]]"},
+ }
+
+ def __init__(self, **kwargs):
+ # type: (Any) -> None
+ super(LogsQueryResultTable, self).__init__(**kwargs)
+ self.name = kwargs["name"]
+ self.columns = kwargs["columns"]
+ self.rows = kwargs["rows"]
+
+
+class LogsQueryResultColumn(InternalColumn):
+ """A column in a table.
+
+ :keyword name: The name of this column.
+ :paramtype name: str
+ :keyword type: The data type of this column.
+ :paramtype type: str
+ """
+
+ _attribute_map = {
+ "name": {"key": "name", "type": "str"},
+ "type": {"key": "type", "type": "str"},
+ }
+
+ def __init__(self, **kwargs):
+ # type: (Any) -> None
+ super(LogsQueryResultColumn, self).__init__(**kwargs)
+ self.name = kwargs.get("name", None)
+ self.type = kwargs.get("type", None)
+
+
+class LogsQueryResults(InternalQueryResults):
+ """Contains the tables, columns & rows resulting from a query.
+
+ :keyword tables: The list of tables, columns and rows.
+ :paramtype tables: list[~monitor_query_client.models.Table]
+ :keyword errors:
+ :paramtype errors: ~monitor_query_client.models.ErrorDetails
+ """
+
+ _attribute_map = {
+ "tables": {"key": "tables", "type": "[Table]"},
+ "errors": {"key": "errors", "type": "ErrorDetails"},
+ }
+
+ def __init__(self, **kwargs):
+ # type: (Any) -> None
+ super(LogsQueryResults, self).__init__(**kwargs)
+ self.tables = kwargs.get("tables", None)
+ self.errors = kwargs.get("errors", None)
+
+
+class MetricsResponse(InternalResponse):
+ """The response to a metrics query.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :keyword cost: The integer value representing the cost of the query, for data case.
+ :paramtype cost: int
+ :keyword timespan: Required. The timespan for which the data was retrieved. Its value consists of
+ two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned
+ back from what was originally requested.
+ :paramtype timespan: str
+ :keyword interval: The interval (window size) for which the metric data was returned in. This
+ may be adjusted in the future and returned back from what was originally requested. This is
+ not present if a metadata request was made.
+ :paramtype interval: ~datetime.timedelta
+ :keyword namespace: The namespace of the metrics been queried.
+ :paramtype namespace: str
+ :keyword resourceregion: The region of the resource been queried for metrics.
+ :paramtype resourceregion: str
+ :keyword value: Required. the value of the collection.
+ :paramtype value: list[~monitor_query_client.models.Metric]
+ """
+
+ _validation = {
+ "cost": {"minimum": 0},
+ "timespan": {"required": True},
+ "value": {"required": True},
+ }
+
+ _attribute_map = {
+ "cost": {"key": "cost", "type": "int"},
+ "timespan": {"key": "timespan", "type": "str"},
+ "interval": {"key": "interval", "type": "duration"},
+ "namespace": {"key": "namespace", "type": "str"},
+ "resourceregion": {"key": "resourceregion", "type": "str"},
+ "value": {"key": "value", "type": "[Metric]"},
+ }
+
+ def __init__(self, **kwargs):
+ # type: (Any) -> None
+ super(MetricsResponse, self).__init__(**kwargs)
+ self.cost = kwargs.get("cost", None)
+ self.timespan = kwargs["timespan"]
+ self.interval = kwargs.get("interval", None)
+ self.namespace = kwargs.get("namespace", None)
+ self.resourceregion = kwargs.get("resourceregion", None)
+ self.value = kwargs["value"]
+
+
+class LogsQueryRequest(InternalLogQueryRequest):
+ """An single request in a batch.
+
+ Variables are only populated by the server, and will be ignored when sending a request.
+
+ :keyword request_id: The error details.
+ :paramtype request_id: str
+ :keyword headers: Dictionary of :code:``.
+ :paramtype headers: dict[str, str]
+ :keyword body: The Analytics query. Learn more about the `Analytics query syntax
+ `_.
+ :paramtype body: ~monitor_query_client.models.QueryBody
+ :keyword workspace: Workspace Id to be included in the query.
+ :paramtype workspace: str
+ """
+
+ def __init__(self, **kwargs):
+ # type: (Any) -> None
+ super(LogsQueryRequest, self).__init__(**kwargs)
+ self.id = kwargs.get("id", uuid.uuid4())
+ self.headers = kwargs.get("headers", {"Content-Type": "application/json"})
+ self.body = kwargs.get("body", None)
+ self.workspace = kwargs.get("workspace", None)
+
+
+class LogsQueryBody(InternalQueryBody):
+ """The Analytics query. Learn more about the `Analytics query syntax `_.
+
+ All required parameters must be populated in order to send to Azure.
+
+ :param query: Required. The query to execute.
+ :type query: str
+ :keyword timespan: Optional. The timespan over which to query data. This is an ISO8601 time
+ period value. This timespan is applied in addition to any that are specified in the query
+ expression.
+ :paramtype timespan: str
+ :keyword workspaces: A list of workspaces that are included in the query.
+ :paramtype workspaces: list[str]
+ :keyword qualified_names: A list of qualified workspace names that are included in the query.
+ :paramtype qualified_names: list[str]
+ :keyword workspace_ids: A list of workspace IDs that are included in the query.
+ :paramtype workspace_ids: list[str]
+ :keyword azure_resource_ids: A list of Azure resource IDs that are included in the query.
+ :paramtype azure_resource_ids: list[str]
+ """
+
+ def __init__(self, query, **kwargs):
+ # type: (str, Any) -> None
+ super(QueryBody, self).__init__(**kwargs)
+ kwargs.setdefault("query", query)
+ self.timespan = kwargs.get("timespan", None)
+ self.workspaces = kwargs.get("workspaces", None)
+ self.qualified_names = kwargs.get("qualified_names", None)
+ self.workspace_ids = kwargs.get("workspace_ids", None)
+ self.azure_resource_ids = kwargs.get("azure_resource_ids", None)
+
+
+class LogsBatchResponse(InternalBatchResponse):
+ """Response to a batch.
+
+ :keyword responses: An array of responses corresponding to each individual request in a batch.
+ :paramtype responses: list[~monitor_query_client.models.LogQueryResponse]
+ :keyword error: Error response for a batch request.
+ :paramtype error: ~monitor_query_client.models.BatchResponseError
+ """
+
+ _attribute_map = {
+ "responses": {"key": "responses", "type": "[LogQueryResponse]"},
+ "error": {"key": "error", "type": "BatchResponseError"},
+ }
+
+ def __init__(self, **kwargs):
+ # type: (Any) -> None
+ super(LogsBatchResponse, self).__init__(**kwargs)
+ self.responses = kwargs.get("responses", None)
+ self.error = kwargs.get("error", None)
+
+
+class BatchResponseError(InternalBatchResponseError):
+ """Error response for a batch request.
+
+ :param message: The error message describing the cause of the error.
+ :type message: str
+ :param code: The error code.
+ :type code: str
+ :param inner_error:
+ :type inner_error: ~monitor_query_client.models.BatchResponseErrorInnerError
+ """
+
+ _attribute_map = {
+ "message": {"key": "message", "type": "str"},
+ "code": {"key": "code", "type": "str"},
+ "inner_error": {"key": "innerError", "type": "BatchResponseErrorInnerError"},
+ }
+
+ def __init__(self, **kwargs):
+ # type: (Any) -> None
+ super(BatchResponseError, self).__init__(**kwargs)
+ self.message = kwargs.get("message", None)
+ self.code = kwargs.get("code", None)
+ self.inner_error = kwargs.get("inner_error", None)
diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_version.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_version.py
new file mode 100644
index 000000000000..ab32f7856eb1
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_version.py
@@ -0,0 +1,8 @@
+# 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.
+# --------------------------------------------------------------------------
+
+VERSION = "1.0.0b1"
diff --git a/sdk/monitor/azure-monitor-query/dev_requirements.txt b/sdk/monitor/azure-monitor-query/dev_requirements.txt
new file mode 100644
index 000000000000..9846116107f7
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/dev_requirements.txt
@@ -0,0 +1,5 @@
+-e ../../../tools/azure-devtools
+-e ../../../tools/azure-sdk-tools
+-e ../../core/azure-core
+-e ../../identity/azure-identity
+aiohttp>=3.0; python_version >= '3.5'
diff --git a/sdk/monitor/azure-monitor-query/mypy.ini b/sdk/monitor/azure-monitor-query/mypy.ini
new file mode 100644
index 000000000000..f9ee4be08ac3
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/mypy.ini
@@ -0,0 +1,13 @@
+[mypy]
+python_version = 3.7
+warn_return_any = True
+warn_unused_configs = True
+ignore_missing_imports = True
+
+# Per-module options:
+
+[mypy-azure.monitor.query._generated.*]
+ignore_errors = True
+
+[mypy-azure.core.*]
+ignore_errors = True
diff --git a/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py
new file mode 100644
index 000000000000..1f911b86f043
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py
@@ -0,0 +1,61 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+import os
+from azure.monitor.query import LogsClient
+from azure.identity import ClientSecretCredential
+
+
+credential = ClientSecretCredential(
+ client_id = os.environ['AZURE_CLIENT_ID'],
+ client_secret = os.environ['AZURE_CLIENT_SECRET'],
+ tenant_id = os.environ['AZURE_TENANT_ID']
+ )
+
+client = LogsClient(credential)
+
+requests = [
+ {
+ "id": "1",
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": {
+ "query": "AzureActivity | summarize count()",
+ "timespan": "PT1H"
+ },
+ "method": "POST",
+ "path": "/query",
+ "workspace": os.environ['LOG_WORKSPACE_ID']
+ },
+ {
+ "id": "2",
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": {
+ "query": "ApplicationInsights | limit 10",
+ "timespan": "PT1H"
+ },
+ "method": "POST",
+ "path": "/fakePath",
+ "workspace": os.environ['LOG_WORKSPACE_ID']
+ }
+]
+response = client.batch_query(requests)
+
+for response in response.responses:
+ print(response.id)
+ print(response.status)
+ body = response.body
+ if not body.tables:
+ print("Something is wrong")
+ else:
+ for table in body.tables:
+ for col in table.columns: #LogsQueryResultColumn
+ print(col.name + "/"+ col.type + " | ", end="")
+ print("\n")
+ for row in table.rows:
+ for item in row:
+ print(item + " | ", end="")
+ print("\n")
diff --git a/sdk/monitor/azure-monitor-query/samples/sample_batch_query_build.py b/sdk/monitor/azure-monitor-query/samples/sample_batch_query_build.py
new file mode 100644
index 000000000000..8fa6dc190848
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/samples/sample_batch_query_build.py
@@ -0,0 +1,35 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+import os
+from azure.monitor.query import LogsClient, LogQueryRequest
+from azure.identity import ClientSecretCredential
+
+
+credential = ClientSecretCredential(
+ client_id = os.environ['AZURE_CLIENT_ID'],
+ client_secret = os.environ['AZURE_CLIENT_SECRET'],
+ tenant_id = os.environ['AZURE_TENANT_ID']
+ )
+
+client = LogsClient(credential)
+
+requests = [
+ LogQueryRequest(
+ body= {
+ "query": "AzureActivity | summarize count()",
+ "timespan": "PT1H"
+ },
+ workspace= os.environ['LOG_WORKSPACE_ID']
+ ),
+ LogQueryRequest(
+ body= {
+ "query": "AzureActivity | summarize count()",
+ "timespan": "PT1H"
+ },
+ workspace= os.environ['LOG_WORKSPACE_ID']
+ ),
+]
+response = client.batch_query(requests)
+
+print(response)
diff --git a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py
new file mode 100644
index 000000000000..cf82e7f0966f
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py
@@ -0,0 +1,52 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+import os
+from datetime import timedelta
+from azure.monitor.query import LogsClient
+from azure.identity import ClientSecretCredential
+
+
+credential = ClientSecretCredential(
+ client_id = os.environ['AZURE_CLIENT_ID'],
+ client_secret = os.environ['AZURE_CLIENT_SECRET'],
+ tenant_id = os.environ['AZURE_TENANT_ID']
+ )
+
+client = LogsClient(credential)
+
+# Response time trend
+# request duration over the last 12 hours.
+query = """AppRequests |
+where TimeGenerated > ago(12h) |
+summarize avgRequestDuration=avg(DurationMs) by bin(TimeGenerated, 10m), _ResourceId"""
+
+# returns LogsQueryResults
+response = client.query(os.environ['LOG_WORKSPACE_ID'], query)
+
+if not response.tables:
+ print("No results for the query")
+
+
+#response.tables is a LogsQueryResultTable
+for table in response.tables:
+ for col in table.columns: #LogsQueryResultColumn
+ print(col.name + "/"+ col.type + " | ", end="")
+ print("\n")
+ for row in table.rows:
+ for item in row:
+ print(item + " | ", end="")
+ print("\n")
+
+
+"""
+TimeGenerated/datetime | _ResourceId/string | avgRequestDuration/real |
+
+2021-05-11T08:20:00Z | /subscriptions//resourcegroups/cobey-azuresdkshinydashboardgrp/providers/microsoft.insights/components/cobey-willthisbestatic | 10.8915 |
+
+2021-05-11T08:30:00Z | /subscriptions//resourcegroups/cobey-azuresdkshinydashboardgrp/providers/microsoft.insights/components/cobey-willthisbestatic | 33.23276666666667 |
+
+2021-05-11T08:40:00Z | /subscriptions//resourcegroups/cobey-azuresdkshinydashboardgrp/providers/microsoft.insights/components/cobey-willthisbestatic | 21.83535 |
+
+2021-05-11T08:50:00Z | /subscriptions//resourcegroups/cobey-azuresdkshinydashboardgrp/providers/microsoft.insights/components/cobey-willthisbestatic | 11.028649999999999 |
+"""
\ No newline at end of file
diff --git a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py
new file mode 100644
index 000000000000..9b9cc09ab421
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py
@@ -0,0 +1,16 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+import os
+from azure.monitor.query import MetricsClient
+from azure.identity import ClientSecretCredential
+
+
+credential = ClientSecretCredential(
+ client_id = os.environ['AZURE_CLIENT_ID'],
+ client_secret = os.environ['AZURE_CLIENT_SECRET'],
+ tenant_id = os.environ['AZURE_TENANT_ID']
+ )
+
+client = MetricsClient(credential)
+response = client.query(os.environ['METRICS_RESOURCE_URI'], metricnames=["Microsoft.CognitiveServices/accounts"])
diff --git a/sdk/monitor/azure-monitor-query/samples/sample_server_timeout.py b/sdk/monitor/azure-monitor-query/samples/sample_server_timeout.py
new file mode 100644
index 000000000000..bd087523e5a8
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/samples/sample_server_timeout.py
@@ -0,0 +1,24 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+import os
+from datetime import timedelta
+from azure.monitor.query import LogsClient
+from azure.identity import ClientSecretCredential
+
+
+credential = ClientSecretCredential(
+ client_id = os.environ['AZURE_CLIENT_ID'],
+ client_secret = os.environ['AZURE_CLIENT_SECRET'],
+ tenant_id = os.environ['AZURE_TENANT_ID']
+ )
+
+client = LogsClient(credential)
+
+response = client.query(
+ os.environ['LOG_WORKSPACE_ID'],
+ "AppRequests | take 1",
+ timeout=100,
+ )
+
+print(response)
\ No newline at end of file
diff --git a/sdk/monitor/azure-monitor-query/sdk_packaging.toml b/sdk/monitor/azure-monitor-query/sdk_packaging.toml
new file mode 100644
index 000000000000..efd98b3f246b
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/sdk_packaging.toml
@@ -0,0 +1,7 @@
+[packaging]
+auto_update = false
+package_name = "azure-monitor-query"
+package_pprint_name = "Monitor Query"
+package_doc_id = "monitor-query"
+is_stable = false
+is_arm = false
diff --git a/sdk/monitor/azure-monitor-query/setup.cfg b/sdk/monitor/azure-monitor-query/setup.cfg
new file mode 100644
index 000000000000..3c6e79cf31da
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/setup.cfg
@@ -0,0 +1,2 @@
+[bdist_wheel]
+universal=1
diff --git a/sdk/monitor/azure-monitor-query/setup.py b/sdk/monitor/azure-monitor-query/setup.py
new file mode 100644
index 000000000000..9a7359e6ec2f
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/setup.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+
+#-------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
+# license information.
+#--------------------------------------------------------------------------
+
+import re
+import os.path
+from io import open
+from setuptools import find_packages, setup
+
+# Change the PACKAGE_NAME only to change folder and different name
+PACKAGE_NAME = "azure-monitor-query"
+PACKAGE_PPRINT_NAME = "Azure Monitor Query"
+
+# a-b-c => a/b/c
+package_folder_path = PACKAGE_NAME.replace('-', '/')
+# a-b-c => a.b.c
+namespace_name = PACKAGE_NAME.replace('-', '.')
+
+# azure v0.x is not compatible with this package
+# azure v0.x used to have a __version__ attribute (newer versions don't)
+try:
+ import azure
+ try:
+ ver = azure.__version__
+ raise Exception(
+ 'This package is incompatible with azure=={}. '.format(ver) +
+ 'Uninstall it with "pip uninstall azure".'
+ )
+ except AttributeError:
+ pass
+except ImportError:
+ pass
+
+# Version extraction inspired from 'requests'
+with open(os.path.join(package_folder_path, 'version.py')
+ if os.path.exists(os.path.join(package_folder_path, 'version.py'))
+ else os.path.join(package_folder_path, '_version.py'), 'r') as fd:
+ version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
+ fd.read(), re.MULTILINE).group(1)
+
+if not version:
+ raise RuntimeError('Cannot find version information')
+
+with open('README.md', encoding='utf-8') as f:
+ readme = f.read()
+with open('CHANGELOG.md', encoding='utf-8') as f:
+ changelog = f.read()
+
+setup(
+ name=PACKAGE_NAME,
+ version=version,
+ description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
+ long_description=readme + '\n\n' + changelog,
+ long_description_content_type='text/markdown',
+ license='MIT License',
+ author='Microsoft Corporation',
+ author_email='azpysdkhelp@microsoft.com',
+ url='https://github.com/Azure/azure-sdk-for-python',
+ classifiers=[
+ "Development Status :: 4 - Beta",
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'License :: OSI Approved :: MIT License',
+ ],
+ zip_safe=False,
+ packages=find_packages(exclude=[
+ 'tests',
+ 'samples',
+ # Exclude packages that will be covered by PEP420 or nspkg
+ 'azure',
+ 'azure.monitor',
+ ]),
+ install_requires=[
+ 'msrest>=0.6.19',
+ 'azure-core<2.0.0,>=1.12.0',
+ ],
+ extras_require={
+ ":python_version<'3.0'": ['azure-nspkg'],
+ }
+)
diff --git a/sdk/monitor/azure-monitor-query/swagger/README.PYTHON.md b/sdk/monitor/azure-monitor-query/swagger/README.PYTHON.md
new file mode 100644
index 000000000000..ee5ddee3929a
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/swagger/README.PYTHON.md
@@ -0,0 +1,26 @@
+# Azure Monitor Query Client for Python
+
+> see https://aka.ms/autorest
+
+### Configuration
+
+```yaml
+title: MonitorQueryClient
+description: Azure Monitor Query Python Client
+generated-metadata: false
+
+license-header: MICROSOFT_MIT_NO_VERSION
+no-namespace-folders: true
+output-folder: ../azure/monitor/query/_generated
+source-code-folder-path: ./azure/monitor/query/_generated
+input-file:
+ - https://github.com/Azure/azure-sdk-for-java/blob/1d14101ba93c6e616899c2ded93fbecb54699f84/sdk/monitor/azure-monitor-query/swagger/log_query_swagger.json
+ - https://github.com/Azure/azure-sdk-for-java/blob/1d14101ba93c6e616899c2ded93fbecb54699f84/sdk/monitor/azure-monitor-query/swagger/metrics_definitions.json
+ - https://github.com/Azure/azure-sdk-for-java/blob/1d14101ba93c6e616899c2ded93fbecb54699f84/sdk/monitor/azure-monitor-query/swagger/metrics_namespaces.json
+ - https://github.com/Azure/azure-sdk-for-java/blob/1d14101ba93c6e616899c2ded93fbecb54699f84/sdk/monitor/azure-monitor-query/swagger/metrics_swagger.json
+modelerfour:
+ lenient-model-deduplication: true
+python: true
+v3: true
+use: "@autorest/python@5.6.4"
+```
\ No newline at end of file
diff --git a/sdk/monitor/azure-monitor-query/tests/test_monitor.py b/sdk/monitor/azure-monitor-query/tests/test_monitor.py
new file mode 100644
index 000000000000..c222e973a8b2
--- /dev/null
+++ b/sdk/monitor/azure-monitor-query/tests/test_monitor.py
@@ -0,0 +1,6 @@
+import pytest
+
+def test_placeholder():
+ ## just a placeholder test to bypass CI exit code 5
+ assert 1 == 1
+
\ No newline at end of file
diff --git a/sdk/monitor/ci.yml b/sdk/monitor/ci.yml
index a4f784d81961..9e9c5dff0a15 100644
--- a/sdk/monitor/ci.yml
+++ b/sdk/monitor/ci.yml
@@ -35,3 +35,5 @@ extends:
safeName: azuremgmtmonitor
- name: azure-monitor-opentelemetry-exporter
safeName: azuremonitoropentelemetryexporter
+ - name: azure-monitor-query
+ safeName: azuremonitorquery
\ No newline at end of file
diff --git a/shared_requirements.txt b/shared_requirements.txt
index 186b7b740268..b21c9e219cf7 100644
--- a/shared_requirements.txt
+++ b/shared_requirements.txt
@@ -181,6 +181,8 @@ opentelemetry-sdk<2.0.0,>=1.0.0
#override azure-ai-anomalydetector azure-core>=1.6.0,<2.0.0
#override azure-eventgrid msrest>=0.6.19
#override azure-eventgrid azure-core<2.0.0,>=1.12.0
+#override azure-monitor-query msrest>=0.6.19
+#override azure-monitor-query azure-core<2.0.0,>=1.12.0
#override azure-communication-chat msrest>=0.6.0
#override azure-communication-sms msrest>=0.6.0
#override azure-communication-phonenumbers msrest>=0.6.0