From 5b2445a12465f0b6bce0982305d706c5050c985e Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Sun, 27 Jun 2021 01:06:08 -0700 Subject: [PATCH 1/5] Regenerate code --- sdk/monitor/azure-monitor-query/README.md | 48 +-- .../query/_generated/_monitor_query_client.py | 10 +- .../_generated/aio/_monitor_query_client.py | 10 +- .../_generated/aio/operations/__init__.py | 4 +- .../_metric_definitions_operations.py | 2 +- .../aio/operations/_metrics_operations.py | 27 +- .../aio/operations/_query_operations.py | 3 +- .../query/_generated/models/__init__.py | 30 +- .../query/_generated/models/_models.py | 307 ++++++++------- .../query/_generated/models/_models_py3.py | 355 ++++++++++-------- .../models/_monitor_query_client_enums.py | 36 +- .../query/_generated/operations/__init__.py | 4 +- .../_metric_definitions_operations.py | 2 +- .../operations/_metrics_operations.py | 27 +- .../operations/_query_operations.py | 3 +- .../sample_log_query_client_async.py | 4 +- .../sample_metric_definitions_async.py | 4 +- .../sample_metric_namespaces_async.py | 4 +- .../sample_metrics_query_client_async.py | 4 +- .../samples/sample_batch_query.py | 8 +- .../samples/sample_batch_query_serialized.py | 8 +- .../samples/sample_log_query_client.py | 8 +- .../sample_log_query_client_without_pandas.py | 8 +- .../sample_log_query_multiple_workspaces.py | 8 +- .../samples/sample_metric_definitions.py | 8 +- .../samples/sample_metric_namespaces.py | 8 +- .../samples/sample_metrics_query_client.py | 8 +- .../samples/sample_server_timeout.py | 8 +- .../swagger/README.PYTHON.md | 8 +- 29 files changed, 519 insertions(+), 445 deletions(-) diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 4bf44092d18e..1ce925928ba6 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -25,28 +25,20 @@ A **token credential** is necessary to instantiate both the LogsQueryClient and ```Python from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) ``` ```Python from azure.monitor.query import MetricsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = MetricsQueryClient(credential) ``` @@ -114,14 +106,10 @@ This sample shows getting a log query. to handle the response and view it in a t import os import pandas as pd from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) @@ -155,14 +143,10 @@ This sample shows sending multiple queries at the same time using batch query AP import os import pandas as pd from azure.monitor.query import LogsQueryClient, LogsQueryRequest -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) @@ -204,14 +188,10 @@ This sample shows setting a server timeout in seconds. A GateWay timeout is rais import os import pandas as pd from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) @@ -229,14 +209,10 @@ This example shows getting the metrics for an EventGrid subscription. The resour ```Python import os from azure.monitor.query import MetricsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = MetricsQueryClient(credential) 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 index 431ba6057abc..570b032c66db 100644 --- 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 @@ -21,8 +21,8 @@ from .operations import QueryOperations from .operations import MetadataOperations from .operations import MetricDefinitionsOperations -from .operations import MetricNamespacesOperations from .operations import MetricsOperations +from .operations import MetricNamespacesOperations from . import models @@ -35,10 +35,10 @@ class MonitorQueryClient(object): :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 + :ivar metric_namespaces: MetricNamespacesOperations operations + :vartype metric_namespaces: monitor_query_client.operations.MetricNamespacesOperations :param host: server parameter. :type host: str :param str base_url: Service URL @@ -67,10 +67,10 @@ def __init__( 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) + self.metric_namespaces = MetricNamespacesOperations( + self._client, self._config, self._serialize, self._deserialize) def _send_request(self, http_request, **kwargs): # type: (HttpRequest, Any) -> HttpResponse 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 index 3afc0571a533..09468aa57cb5 100644 --- 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 @@ -16,8 +16,8 @@ from .operations import QueryOperations from .operations import MetadataOperations from .operations import MetricDefinitionsOperations -from .operations import MetricNamespacesOperations from .operations import MetricsOperations +from .operations import MetricNamespacesOperations from .. import models @@ -30,10 +30,10 @@ class MonitorQueryClient(object): :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 + :ivar metric_namespaces: MetricNamespacesOperations operations + :vartype metric_namespaces: monitor_query_client.aio.operations.MetricNamespacesOperations :param host: server parameter. :type host: str :param str base_url: Service URL @@ -61,10 +61,10 @@ def __init__( 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) + self.metric_namespaces = MetricNamespacesOperations( + 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. 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 index 7c1dc25c27bd..ffc8eb179302 100644 --- 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 @@ -9,13 +9,13 @@ 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 +from ._metric_namespaces_operations import MetricNamespacesOperations __all__ = [ 'QueryOperations', 'MetadataOperations', 'MetricDefinitionsOperations', - 'MetricNamespacesOperations', 'MetricsOperations', + 'MetricNamespacesOperations', ] 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 index 72029d2db0e8..1fcf25d90b24 100644 --- 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 @@ -113,4 +113,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # 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 index 72851113e0ad..3eda758563c6 100644 --- 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 @@ -63,7 +63,9 @@ async def list( :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. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param aggregation: The list of aggregation types (comma separated) to retrieve. :type aggregation: str @@ -75,15 +77,18 @@ async def list( 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 ‘*\ ’**. + :param filter: The **$filter** is used to reduce the set of metric data returned. Example: + Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or + b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A + eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or + operator cannot separate two different metadata names. - Return all time series where A = a1, B + = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series + where A = a1 **$filter=A eq 'a1' and B eq '\ *' and C eq '*\ '**. Special case: When dimension + name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** + Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ + ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ + ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. :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. @@ -151,4 +156,4 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + 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 index 4c49db9b9c04..4c80f2720cd0 100644 --- 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 @@ -125,7 +125,8 @@ async def execute( :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,. + :param prefer: Optional. The prefer header to set server timeout, query statistics and + visualization information. :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) 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 index 4f1b1146bd3b..a00544c7557a 100644 --- 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 @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import BatchQueryRequest + from ._models_py3 import BatchQueryResponse + from ._models_py3 import BatchQueryResults from ._models_py3 import BatchRequest from ._models_py3 import BatchResponse from ._models_py3 import Column @@ -15,9 +18,6 @@ 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 LogQueryResult from ._models_py3 import MetadataApplication from ._models_py3 import MetadataApplicationRelated from ._models_py3 import MetadataCategory @@ -55,6 +55,9 @@ from ._models_py3 import Table from ._models_py3 import TimeSeriesElement except (SyntaxError, ImportError): + from ._models import BatchQueryRequest # type: ignore + from ._models import BatchQueryResponse # type: ignore + from ._models import BatchQueryResults # type: ignore from ._models import BatchRequest # type: ignore from ._models import BatchResponse # type: ignore from ._models import Column # type: ignore @@ -63,9 +66,6 @@ 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 LogQueryResult # type: ignore from ._models import MetadataApplication # type: ignore from ._models import MetadataApplicationRelated # type: ignore from ._models import MetadataCategory # type: ignore @@ -105,13 +105,18 @@ from ._monitor_query_client_enums import ( AggregationType, - ColumnDataType, + LogsColumnType, MetadataColumnDataType, + MetricClass, + MetricUnit, + NamespaceClassification, ResultType, - Unit, ) __all__ = [ + 'BatchQueryRequest', + 'BatchQueryResponse', + 'BatchQueryResults', 'BatchRequest', 'BatchResponse', 'Column', @@ -120,9 +125,6 @@ 'ErrorResponse', 'ErrorResponseAutoGenerated', 'LocalizableString', - 'LogQueryRequest', - 'LogQueryResponse', - 'LogQueryResult', 'MetadataApplication', 'MetadataApplicationRelated', 'MetadataCategory', @@ -160,8 +162,10 @@ 'Table', 'TimeSeriesElement', 'AggregationType', - 'ColumnDataType', + 'LogsColumnType', 'MetadataColumnDataType', + 'MetricClass', + 'MetricUnit', + 'NamespaceClassification', '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 index 30613f0fc7b2..27f1f05ef4ff 100644 --- 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 @@ -10,15 +10,136 @@ import msrest.serialization +class BatchQueryRequest(msrest.serialization.Model): + """An single request in a batch. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The error details. + :type id: str + :param headers: Dictionary of :code:``. + :type headers: dict[str, str] + :param body: Required. 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: Required. Workspace Id to be included in the query. + :type workspace: str + """ + + _validation = { + 'id': {'required': True}, + 'body': {'required': True}, + 'path': {'constant': True}, + 'method': {'constant': True}, + 'workspace': {'required': 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(BatchQueryRequest, self).__init__(**kwargs) + self.id = kwargs['id'] + self.headers = kwargs.get('headers', None) + self.body = kwargs['body'] + self.workspace = kwargs['workspace'] + + +class BatchQueryResponse(msrest.serialization.Model): + """BatchQueryResponse. + + :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.BatchQueryResults + :param headers: Dictionary of :code:``. + :type headers: dict[str, str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'int'}, + 'body': {'key': 'body', 'type': 'BatchQueryResults'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchQueryResponse, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.status = kwargs.get('status', None) + self.body = kwargs.get('body', None) + self.headers = kwargs.get('headers', None) + + +class BatchQueryResults(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 statistics: Statistics represented in JSON format. + :type statistics: object + :param render: Visualization data in JSON format. + :type render: object + :param error: The code and message for an error. + :type error: ~monitor_query_client.models.ErrorInfo + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[Table]'}, + 'statistics': {'key': 'statistics', 'type': 'object'}, + 'render': {'key': 'render', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchQueryResults, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) + self.statistics = kwargs.get('statistics', None) + self.render = kwargs.get('render', None) + self.error = kwargs.get('error', None) + + 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] + All required parameters must be populated in order to send to Azure. + + :param requests: Required. An single request in a batch. + :type requests: list[~monitor_query_client.models.BatchQueryRequest] """ + _validation = { + 'requests': {'required': True}, + } + _attribute_map = { - 'requests': {'key': 'requests', 'type': '[LogQueryRequest]'}, + 'requests': {'key': 'requests', 'type': '[BatchQueryRequest]'}, } def __init__( @@ -26,18 +147,18 @@ def __init__( **kwargs ): super(BatchRequest, self).__init__(**kwargs) - self.requests = kwargs.get('requests', None) + self.requests = kwargs['requests'] class BatchResponse(msrest.serialization.Model): - """Response to a batch. + """Response to a batch query. :param responses: An array of responses corresponding to each individual request in a batch. - :type responses: list[~monitor_query_client.models.LogQueryResponse] + :type responses: list[~monitor_query_client.models.BatchQueryResponse] """ _attribute_map = { - 'responses': {'key': 'responses', 'type': '[LogQueryResponse]'}, + 'responses': {'key': 'responses', 'type': '[BatchQueryResponse]'}, } def __init__( @@ -56,8 +177,8 @@ class Column(msrest.serialization.Model): :param name: Required. The name of this column. :type name: str :param type: Required. The data type of this column. Possible values include: "bool", - "datetime", "dynamic", "int", "long", "real", "string". - :type type: str or ~monitor_query_client.models.ColumnDataType + "datetime", "dynamic", "int", "long", "real", "string", "guid", "decimal", "timespan". + :type type: str or ~monitor_query_client.models.LogsColumnType """ _validation = { @@ -246,117 +367,6 @@ def __init__( 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 the query or the error details - if the query failed. - :type body: ~monitor_query_client.models.LogQueryResult - :param headers: Dictionary of :code:``. - :type headers: dict[str, str] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'int'}, - 'body': {'key': 'body', 'type': 'LogQueryResult'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - } - - 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) - self.headers = kwargs.get('headers', None) - - -class LogQueryResult(msrest.serialization.Model): - """Contains the tables, columns & rows resulting from the query or the error details if the query failed. - - :param tables: The list of tables, columns and rows. - :type tables: list[~monitor_query_client.models.Table] - :param error: The code and message for an error. - :type error: ~monitor_query_client.models.ErrorInfo - :param statistics: Any object. - :type statistics: object - :param render: Any object. - :type render: object - """ - - _attribute_map = { - 'tables': {'key': 'tables', 'type': '[Table]'}, - 'error': {'key': 'error', 'type': 'ErrorInfo'}, - 'statistics': {'key': 'statistics', 'type': 'object'}, - 'render': {'key': 'render', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(LogQueryResult, self).__init__(**kwargs) - self.tables = kwargs.get('tables', None) - self.error = kwargs.get('error', None) - self.statistics = kwargs.get('statistics', None) - self.render = kwargs.get('render', None) - - class MetadataApplication(msrest.serialization.Model): """Application Insights apps that were part of the metadata request and that the user has access to. @@ -1121,7 +1131,7 @@ class MetadataTableColumnsItem(msrest.serialization.Model): :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". + "datetime", "dynamic", "int", "long", "real", "string", "guid", "decimal", "timespan". :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 @@ -1308,10 +1318,16 @@ class Metric(msrest.serialization.Model): :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", + :param display_description: Detailed description of this metric. + :type display_description: str + :param error_code: 'Success' or the error details on query failures for this metric. + :type error_code: str + :param error_message: Error message encountered querying this specific metric. + :type error_message: str + :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 + :type unit: str or ~monitor_query_client.models.MetricUnit :param timeseries: Required. the time series returned when a data query is performed. :type timeseries: list[~monitor_query_client.models.TimeSeriesElement] """ @@ -1328,6 +1344,9 @@ class Metric(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, } @@ -1340,6 +1359,9 @@ def __init__( self.id = kwargs['id'] self.type = kwargs['type'] self.name = kwargs['name'] + self.display_description = kwargs.get('display_description', None) + self.error_code = kwargs.get('error_code', None) + self.error_message = kwargs.get('error_message', None) self.unit = kwargs['unit'] self.timeseries = kwargs['timeseries'] @@ -1380,10 +1402,17 @@ class MetricDefinition(msrest.serialization.Model): :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", + :param display_description: Detailed description of this metric. + :type display_description: str + :param category: Custom category name for this metric. + :type category: str + :param metric_class: The class of the metric. Possible values include: "Availability", + "Transactions", "Errors", "Latency", "Saturation". + :type metric_class: str or ~monitor_query_client.models.MetricClass + :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 + :type unit: str or ~monitor_query_client.models.MetricUnit :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". @@ -1405,6 +1434,9 @@ class MetricDefinition(msrest.serialization.Model): 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'namespace': {'key': 'namespace', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'metric_class': {'key': 'metricClass', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, @@ -1422,6 +1454,9 @@ def __init__( self.resource_id = kwargs.get('resource_id', None) self.namespace = kwargs.get('namespace', None) self.name = kwargs.get('name', None) + self.display_description = kwargs.get('display_description', None) + self.category = kwargs.get('category', None) + self.metric_class = kwargs.get('metric_class', 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) @@ -1458,12 +1493,14 @@ def __init__( class MetricNamespace(msrest.serialization.Model): """Metric namespace class specifies the metadata for a metric namespace. - :param id: The ID of the metricNamespace. + :param id: The ID of the metric namespace. :type id: str :param type: The type of the namespace. :type type: str - :param name: The name of the namespace. + :param name: The escaped name of the namespace. :type name: str + :param classification: Kind of namespace. Possible values include: "Platform", "Custom", "Qos". + :type classification: str or ~monitor_query_client.models.NamespaceClassification :param properties: Properties which include the fully qualified namespace name. :type properties: ~monitor_query_client.models.MetricNamespaceName """ @@ -1472,6 +1509,7 @@ class MetricNamespace(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'classification': {'key': 'classification', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, } @@ -1483,6 +1521,7 @@ def __init__( self.id = kwargs.get('id', None) self.type = kwargs.get('type', None) self.name = kwargs.get('name', None) + self.classification = kwargs.get('classification', None) self.properties = kwargs.get('properties', None) @@ -1622,6 +1661,8 @@ class QueryResults(msrest.serialization.Model): :type statistics: object :param render: Any object. :type render: object + :param error: The code and message for an error. + :type error: ~monitor_query_client.models.ErrorInfo """ _validation = { @@ -1632,6 +1673,7 @@ class QueryResults(msrest.serialization.Model): 'tables': {'key': 'tables', 'type': '[Table]'}, 'statistics': {'key': 'statistics', 'type': 'object'}, 'render': {'key': 'render', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorInfo'}, } def __init__( @@ -1642,6 +1684,7 @@ def __init__( self.tables = kwargs['tables'] self.statistics = kwargs.get('statistics', None) self.render = kwargs.get('render', None) + self.error = kwargs.get('error', None) class Response(msrest.serialization.Model): @@ -1649,7 +1692,7 @@ class Response(msrest.serialization.Model): 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. + :param cost: The integer value representing the relative cost of the query. :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 @@ -1659,9 +1702,9 @@ class Response(msrest.serialization.Model): 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. + :param namespace: The namespace of the metrics being queried. :type namespace: str - :param resourceregion: The region of the resource been queried for metrics. + :param resourceregion: The region of the resource being queried for metrics. :type resourceregion: str :param value: Required. the value of the collection. :type value: list[~monitor_query_client.models.Metric] @@ -1705,7 +1748,7 @@ class Table(msrest.serialization.Model): :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]] + :type rows: list[list[object]] """ _validation = { @@ -1717,7 +1760,7 @@ class Table(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'columns': {'key': 'columns', 'type': '[Column]'}, - 'rows': {'key': 'rows', 'type': '[[str]]'}, + 'rows': {'key': 'rows', 'type': '[[object]]'}, } def __init__( 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 index 03ee8f331112..07aad3a671c1 100644 --- 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 @@ -15,21 +15,157 @@ from ._monitor_query_client_enums import * +class BatchQueryRequest(msrest.serialization.Model): + """An single request in a batch. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The error details. + :type id: str + :param headers: Dictionary of :code:``. + :type headers: dict[str, str] + :param body: Required. 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: Required. Workspace Id to be included in the query. + :type workspace: str + """ + + _validation = { + 'id': {'required': True}, + 'body': {'required': True}, + 'path': {'constant': True}, + 'method': {'constant': True}, + 'workspace': {'required': 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: str, + body: "QueryBody", + workspace: str, + headers: Optional[Dict[str, str]] = None, + **kwargs + ): + super(BatchQueryRequest, self).__init__(**kwargs) + self.id = id + self.headers = headers + self.body = body + self.workspace = workspace + + +class BatchQueryResponse(msrest.serialization.Model): + """BatchQueryResponse. + + :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.BatchQueryResults + :param headers: Dictionary of :code:``. + :type headers: dict[str, str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'int'}, + 'body': {'key': 'body', 'type': 'BatchQueryResults'}, + 'headers': {'key': 'headers', 'type': '{str}'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + status: Optional[int] = None, + body: Optional["BatchQueryResults"] = None, + headers: Optional[Dict[str, str]] = None, + **kwargs + ): + super(BatchQueryResponse, self).__init__(**kwargs) + self.id = id + self.status = status + self.body = body + self.headers = headers + + +class BatchQueryResults(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 statistics: Statistics represented in JSON format. + :type statistics: object + :param render: Visualization data in JSON format. + :type render: object + :param error: The code and message for an error. + :type error: ~monitor_query_client.models.ErrorInfo + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[Table]'}, + 'statistics': {'key': 'statistics', 'type': 'object'}, + 'render': {'key': 'render', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorInfo'}, + } + + def __init__( + self, + *, + tables: Optional[List["Table"]] = None, + statistics: Optional[object] = None, + render: Optional[object] = None, + error: Optional["ErrorInfo"] = None, + **kwargs + ): + super(BatchQueryResults, self).__init__(**kwargs) + self.tables = tables + self.statistics = statistics + self.render = render + self.error = error + + 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] + All required parameters must be populated in order to send to Azure. + + :param requests: Required. An single request in a batch. + :type requests: list[~monitor_query_client.models.BatchQueryRequest] """ + _validation = { + 'requests': {'required': True}, + } + _attribute_map = { - 'requests': {'key': 'requests', 'type': '[LogQueryRequest]'}, + 'requests': {'key': 'requests', 'type': '[BatchQueryRequest]'}, } def __init__( self, *, - requests: Optional[List["LogQueryRequest"]] = None, + requests: List["BatchQueryRequest"], **kwargs ): super(BatchRequest, self).__init__(**kwargs) @@ -37,20 +173,20 @@ def __init__( class BatchResponse(msrest.serialization.Model): - """Response to a batch. + """Response to a batch query. :param responses: An array of responses corresponding to each individual request in a batch. - :type responses: list[~monitor_query_client.models.LogQueryResponse] + :type responses: list[~monitor_query_client.models.BatchQueryResponse] """ _attribute_map = { - 'responses': {'key': 'responses', 'type': '[LogQueryResponse]'}, + 'responses': {'key': 'responses', 'type': '[BatchQueryResponse]'}, } def __init__( self, *, - responses: Optional[List["LogQueryResponse"]] = None, + responses: Optional[List["BatchQueryResponse"]] = None, **kwargs ): super(BatchResponse, self).__init__(**kwargs) @@ -65,8 +201,8 @@ class Column(msrest.serialization.Model): :param name: Required. The name of this column. :type name: str :param type: Required. The data type of this column. Possible values include: "bool", - "datetime", "dynamic", "int", "long", "real", "string". - :type type: str or ~monitor_query_client.models.ColumnDataType + "datetime", "dynamic", "int", "long", "real", "string", "guid", "decimal", "timespan". + :type type: str or ~monitor_query_client.models.LogsColumnType """ _validation = { @@ -83,7 +219,7 @@ def __init__( self, *, name: str, - type: Union[str, "ColumnDataType"], + type: Union[str, "LogsColumnType"], **kwargs ): super(Column, self).__init__(**kwargs) @@ -279,132 +415,6 @@ def __init__( 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 the query or the error details - if the query failed. - :type body: ~monitor_query_client.models.LogQueryResult - :param headers: Dictionary of :code:``. - :type headers: dict[str, str] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'int'}, - 'body': {'key': 'body', 'type': 'LogQueryResult'}, - 'headers': {'key': 'headers', 'type': '{str}'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - status: Optional[int] = None, - body: Optional["LogQueryResult"] = None, - headers: Optional[Dict[str, str]] = None, - **kwargs - ): - super(LogQueryResponse, self).__init__(**kwargs) - self.id = id - self.status = status - self.body = body - self.headers = headers - - -class LogQueryResult(msrest.serialization.Model): - """Contains the tables, columns & rows resulting from the query or the error details if the query failed. - - :param tables: The list of tables, columns and rows. - :type tables: list[~monitor_query_client.models.Table] - :param error: The code and message for an error. - :type error: ~monitor_query_client.models.ErrorInfo - :param statistics: Any object. - :type statistics: object - :param render: Any object. - :type render: object - """ - - _attribute_map = { - 'tables': {'key': 'tables', 'type': '[Table]'}, - 'error': {'key': 'error', 'type': 'ErrorInfo'}, - 'statistics': {'key': 'statistics', 'type': 'object'}, - 'render': {'key': 'render', 'type': 'object'}, - } - - def __init__( - self, - *, - tables: Optional[List["Table"]] = None, - error: Optional["ErrorInfo"] = None, - statistics: Optional[object] = None, - render: Optional[object] = None, - **kwargs - ): - super(LogQueryResult, self).__init__(**kwargs) - self.tables = tables - self.error = error - self.statistics = statistics - self.render = render - - class MetadataApplication(msrest.serialization.Model): """Application Insights apps that were part of the metadata request and that the user has access to. @@ -1282,7 +1292,7 @@ class MetadataTableColumnsItem(msrest.serialization.Model): :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". + "datetime", "dynamic", "int", "long", "real", "string", "guid", "decimal", "timespan". :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 @@ -1497,10 +1507,16 @@ class Metric(msrest.serialization.Model): :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", + :param display_description: Detailed description of this metric. + :type display_description: str + :param error_code: 'Success' or the error details on query failures for this metric. + :type error_code: str + :param error_message: Error message encountered querying this specific metric. + :type error_message: str + :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 + :type unit: str or ~monitor_query_client.models.MetricUnit :param timeseries: Required. the time series returned when a data query is performed. :type timeseries: list[~monitor_query_client.models.TimeSeriesElement] """ @@ -1517,6 +1533,9 @@ class Metric(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'timeseries': {'key': 'timeseries', 'type': '[TimeSeriesElement]'}, } @@ -1527,14 +1546,20 @@ def __init__( id: str, type: str, name: "LocalizableString", - unit: Union[str, "Unit"], + unit: Union[str, "MetricUnit"], timeseries: List["TimeSeriesElement"], + display_description: Optional[str] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, **kwargs ): super(Metric, self).__init__(**kwargs) self.id = id self.type = type self.name = name + self.display_description = display_description + self.error_code = error_code + self.error_message = error_message self.unit = unit self.timeseries = timeseries @@ -1578,10 +1603,17 @@ class MetricDefinition(msrest.serialization.Model): :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", + :param display_description: Detailed description of this metric. + :type display_description: str + :param category: Custom category name for this metric. + :type category: str + :param metric_class: The class of the metric. Possible values include: "Availability", + "Transactions", "Errors", "Latency", "Saturation". + :type metric_class: str or ~monitor_query_client.models.MetricClass + :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 + :type unit: str or ~monitor_query_client.models.MetricUnit :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". @@ -1603,6 +1635,9 @@ class MetricDefinition(msrest.serialization.Model): 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'namespace': {'key': 'namespace', 'type': 'str'}, 'name': {'key': 'name', 'type': 'LocalizableString'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'metric_class': {'key': 'metricClass', 'type': 'str'}, 'unit': {'key': 'unit', 'type': 'str'}, 'primary_aggregation_type': {'key': 'primaryAggregationType', 'type': 'str'}, 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, @@ -1618,7 +1653,10 @@ def __init__( resource_id: Optional[str] = None, namespace: Optional[str] = None, name: Optional["LocalizableString"] = None, - unit: Optional[Union[str, "Unit"]] = None, + display_description: Optional[str] = None, + category: Optional[str] = None, + metric_class: Optional[Union[str, "MetricClass"]] = None, + unit: Optional[Union[str, "MetricUnit"]] = None, primary_aggregation_type: Optional[Union[str, "AggregationType"]] = None, supported_aggregation_types: Optional[List[Union[str, "AggregationType"]]] = None, metric_availabilities: Optional[List["MetricAvailability"]] = None, @@ -1631,6 +1669,9 @@ def __init__( self.resource_id = resource_id self.namespace = namespace self.name = name + self.display_description = display_description + self.category = category + self.metric_class = metric_class self.unit = unit self.primary_aggregation_type = primary_aggregation_type self.supported_aggregation_types = supported_aggregation_types @@ -1669,12 +1710,14 @@ def __init__( class MetricNamespace(msrest.serialization.Model): """Metric namespace class specifies the metadata for a metric namespace. - :param id: The ID of the metricNamespace. + :param id: The ID of the metric namespace. :type id: str :param type: The type of the namespace. :type type: str - :param name: The name of the namespace. + :param name: The escaped name of the namespace. :type name: str + :param classification: Kind of namespace. Possible values include: "Platform", "Custom", "Qos". + :type classification: str or ~monitor_query_client.models.NamespaceClassification :param properties: Properties which include the fully qualified namespace name. :type properties: ~monitor_query_client.models.MetricNamespaceName """ @@ -1683,6 +1726,7 @@ class MetricNamespace(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'classification': {'key': 'classification', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'MetricNamespaceName'}, } @@ -1692,6 +1736,7 @@ def __init__( id: Optional[str] = None, type: Optional[str] = None, name: Optional[str] = None, + classification: Optional[Union[str, "NamespaceClassification"]] = None, properties: Optional["MetricNamespaceName"] = None, **kwargs ): @@ -1699,6 +1744,7 @@ def __init__( self.id = id self.type = type self.name = name + self.classification = classification self.properties = properties @@ -1853,6 +1899,8 @@ class QueryResults(msrest.serialization.Model): :type statistics: object :param render: Any object. :type render: object + :param error: The code and message for an error. + :type error: ~monitor_query_client.models.ErrorInfo """ _validation = { @@ -1863,6 +1911,7 @@ class QueryResults(msrest.serialization.Model): 'tables': {'key': 'tables', 'type': '[Table]'}, 'statistics': {'key': 'statistics', 'type': 'object'}, 'render': {'key': 'render', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorInfo'}, } def __init__( @@ -1871,12 +1920,14 @@ def __init__( tables: List["Table"], statistics: Optional[object] = None, render: Optional[object] = None, + error: Optional["ErrorInfo"] = None, **kwargs ): super(QueryResults, self).__init__(**kwargs) self.tables = tables self.statistics = statistics self.render = render + self.error = error class Response(msrest.serialization.Model): @@ -1884,7 +1935,7 @@ class Response(msrest.serialization.Model): 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. + :param cost: The integer value representing the relative cost of the query. :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 @@ -1894,9 +1945,9 @@ class Response(msrest.serialization.Model): 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. + :param namespace: The namespace of the metrics being queried. :type namespace: str - :param resourceregion: The region of the resource been queried for metrics. + :param resourceregion: The region of the resource being queried for metrics. :type resourceregion: str :param value: Required. the value of the collection. :type value: list[~monitor_query_client.models.Metric] @@ -1947,7 +1998,7 @@ class Table(msrest.serialization.Model): :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]] + :type rows: list[list[object]] """ _validation = { @@ -1959,7 +2010,7 @@ class Table(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'columns': {'key': 'columns', 'type': '[Column]'}, - 'rows': {'key': 'rows', 'type': '[[str]]'}, + 'rows': {'key': 'rows', 'type': '[[object]]'}, } def __init__( @@ -1967,7 +2018,7 @@ def __init__( *, name: str, columns: List["Column"], - rows: List[List[str]], + rows: List[List[object]], **kwargs ): super(Table, self).__init__(**kwargs) 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 index 09b2171d2811..c2af2fb7626c 100644 --- 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 @@ -37,7 +37,7 @@ class AggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MAXIMUM = "Maximum" TOTAL = "Total" -class ColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LogsColumnType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The data type of this column. """ @@ -48,6 +48,9 @@ class ColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LONG = "long" REAL = "real" STRING = "string" + GUID = "guid" + DECIMAL = "decimal" + TIMESPAN = "timespan" class MetadataColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The data type of the column @@ -60,14 +63,22 @@ class MetadataColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) LONG = "long" REAL = "real" STRING = "string" + GUID = "guid" + DECIMAL = "decimal" + TIMESPAN = "timespan" -class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricClass(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The class of the metric. + """ - DATA = "Data" - METADATA = "Metadata" + AVAILABILITY = "Availability" + TRANSACTIONS = "Transactions" + ERRORS = "Errors" + LATENCY = "Latency" + SATURATION = "Saturation" -class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """the unit of the metric. +class MetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit of the metric. """ COUNT = "Count" @@ -83,3 +94,16 @@ class Unit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MILLI_CORES = "MilliCores" NANO_CORES = "NanoCores" BITS_PER_SECOND = "BitsPerSecond" + +class NamespaceClassification(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Kind of namespace + """ + + PLATFORM = "Platform" + CUSTOM = "Custom" + QOS = "Qos" + +class ResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DATA = "Data" + METADATA = "Metadata" 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 index 7c1dc25c27bd..ffc8eb179302 100644 --- 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 @@ -9,13 +9,13 @@ 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 +from ._metric_namespaces_operations import MetricNamespacesOperations __all__ = [ 'QueryOperations', 'MetadataOperations', 'MetricDefinitionsOperations', - 'MetricNamespacesOperations', 'MetricsOperations', + 'MetricNamespacesOperations', ] 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 index a8e009b3aa5c..75d3791aeb82 100644 --- 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 @@ -118,4 +118,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metricDefinitions'} # type: ignore + list.metadata = {'url': '/{resourceUri}/providers/Microsoft.Insights/metricDefinitions'} # 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 index c47b1a859fbd..5664b494e227 100644 --- 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 @@ -68,7 +68,9 @@ def list( :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. + :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a + metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be + **'Metric%2Name1'**. :type metricnames: str :param aggregation: The list of aggregation types (comma separated) to retrieve. :type aggregation: str @@ -80,15 +82,18 @@ def list( 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 ‘*\ ’**. + :param filter: The **$filter** is used to reduce the set of metric data returned. Example: + Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or + b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A + eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or + operator cannot separate two different metadata names. - Return all time series where A = a1, B + = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series + where A = a1 **$filter=A eq 'a1' and B eq '\ *' and C eq '*\ '**. Special case: When dimension + name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** + Instead of using $filter= "dim (test) 1 eq '\ *' " use **$filter= "dim %2528test%2529 1 eq '*\ + ' "\ ** When dimension name is **\ dim (test) 3\ ** and dimension value is **\ dim3 (test) val\ + ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\ $filter= "dim + %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. :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. @@ -156,4 +161,4 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/{resourceUri}/providers/microsoft.insights/metrics'} # type: ignore + 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 index 72d0c7fafe85..9c5f48e887a8 100644 --- 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 @@ -131,7 +131,8 @@ def execute( :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,. + :param prefer: Optional. The prefer header to set server timeout, query statistics and + visualization information. :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) diff --git a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py index 3a2c30e96b75..30514de86a56 100644 --- a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_log_query_client_async.py @@ -5,10 +5,10 @@ import os import pandas as pd from azure.monitor.query.aio import LogsQueryClient -from azure.identity.aio import ClientSecretCredential +from azure.identity.aio import DefaultAzureCredential async def logs_query(): - credential = ClientSecretCredential( + credential = DefaultAzureCredential( client_id = os.environ['AZURE_CLIENT_ID'], client_secret = os.environ['AZURE_CLIENT_SECRET'], tenant_id = os.environ['AZURE_TENANT_ID'] diff --git a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_definitions_async.py b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_definitions_async.py index 91b5bd45145e..c18265716966 100644 --- a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_definitions_async.py +++ b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_definitions_async.py @@ -4,10 +4,10 @@ import os import asyncio from azure.monitor.query.aio import MetricsQueryClient -from azure.identity.aio import ClientSecretCredential +from azure.identity.aio import DefaultAzureCredential async def list_namespaces(): - credential = ClientSecretCredential( + credential = DefaultAzureCredential( client_id = os.environ['AZURE_CLIENT_ID'], client_secret = os.environ['AZURE_CLIENT_SECRET'], tenant_id = os.environ['AZURE_TENANT_ID'] diff --git a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_namespaces_async.py b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_namespaces_async.py index 6b56d64fda7e..99cfbb7bef5a 100644 --- a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_namespaces_async.py +++ b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metric_namespaces_async.py @@ -4,10 +4,10 @@ import os import asyncio from azure.monitor.query.aio import MetricsQueryClient -from azure.identity.aio import ClientSecretCredential +from azure.identity.aio import DefaultAzureCredential async def list_namespaces(): - credential = ClientSecretCredential( + credential = DefaultAzureCredential( client_id = os.environ['AZURE_CLIENT_ID'], client_secret = os.environ['AZURE_CLIENT_SECRET'], tenant_id = os.environ['AZURE_TENANT_ID'] diff --git a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py index 0b3e673caa61..f19a091950c2 100644 --- a/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/samples/async_samples/sample_metrics_query_client_async.py @@ -6,12 +6,12 @@ from datetime import datetime import urllib3 from azure.monitor.query.aio import MetricsQueryClient -from azure.identity.aio import ClientSecretCredential +from azure.identity.aio import DefaultAzureCredential urllib3.disable_warnings() async def query_metrics(): - credential = ClientSecretCredential( + credential = DefaultAzureCredential( client_id = os.environ['AZURE_CLIENT_ID'], client_secret = os.environ['AZURE_CLIENT_SECRET'], tenant_id = os.environ['AZURE_TENANT_ID'] diff --git a/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py index eff925ea8a44..f61e1a6adf56 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py @@ -5,14 +5,10 @@ import os import pandas as pd from azure.monitor.query import LogsQueryClient, LogsQueryRequest -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) diff --git a/sdk/monitor/azure-monitor-query/samples/sample_batch_query_serialized.py b/sdk/monitor/azure-monitor-query/samples/sample_batch_query_serialized.py index a0ec5658a5a8..cdf140b22f17 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_batch_query_serialized.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_batch_query_serialized.py @@ -4,14 +4,10 @@ import os import pandas as pd from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) 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 index 10a160f71bed..ef124084bc98 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client.py @@ -6,14 +6,10 @@ from datetime import datetime from msrest.serialization import UTC from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential # [START client_auth_with_token_cred] -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) # [END client_auth_with_token_cred] diff --git a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py index fa74b229e3ed..46a3912608c3 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_log_query_client_without_pandas.py @@ -5,13 +5,9 @@ from datetime import datetime from msrest.serialization import UTC from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) diff --git a/sdk/monitor/azure-monitor-query/samples/sample_log_query_multiple_workspaces.py b/sdk/monitor/azure-monitor-query/samples/sample_log_query_multiple_workspaces.py index dcaf828e5145..f4c90e079523 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_log_query_multiple_workspaces.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_log_query_multiple_workspaces.py @@ -6,13 +6,9 @@ from datetime import datetime from msrest.serialization import UTC from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) diff --git a/sdk/monitor/azure-monitor-query/samples/sample_metric_definitions.py b/sdk/monitor/azure-monitor-query/samples/sample_metric_definitions.py index 0891b8c7ebda..f8694b559e05 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_metric_definitions.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_metric_definitions.py @@ -3,13 +3,9 @@ import os from azure.monitor.query import MetricsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = MetricsQueryClient(credential) diff --git a/sdk/monitor/azure-monitor-query/samples/sample_metric_namespaces.py b/sdk/monitor/azure-monitor-query/samples/sample_metric_namespaces.py index a7bbbda4e95e..f5f32ce73996 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_metric_namespaces.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_metric_namespaces.py @@ -3,13 +3,9 @@ import os from azure.monitor.query import MetricsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = MetricsQueryClient(credential) 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 index 2230ee736f1d..1a4871bbee53 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_metrics_query_client.py @@ -5,16 +5,12 @@ from datetime import datetime, timedelta import urllib3 from azure.monitor.query import MetricsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential urllib3.disable_warnings() # [START metrics_client_auth_with_token_cred] -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = MetricsQueryClient(credential) # [END metrics_client_auth_with_token_cred] diff --git a/sdk/monitor/azure-monitor-query/samples/sample_server_timeout.py b/sdk/monitor/azure-monitor-query/samples/sample_server_timeout.py index 9b1c0b19bd3c..6d7e8f205259 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_server_timeout.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_server_timeout.py @@ -4,14 +4,10 @@ import os import pandas as pd from azure.monitor.query import LogsQueryClient -from azure.identity import ClientSecretCredential +from azure.identity import DefaultAzureCredential -credential = ClientSecretCredential( - client_id = os.environ['AZURE_CLIENT_ID'], - client_secret = os.environ['AZURE_CLIENT_SECRET'], - tenant_id = os.environ['AZURE_TENANT_ID'] - ) +credential = DefaultAzureCredential() client = LogsQueryClient(credential) diff --git a/sdk/monitor/azure-monitor-query/swagger/README.PYTHON.md b/sdk/monitor/azure-monitor-query/swagger/README.PYTHON.md index ab2e46ec9443..3def60fa9993 100644 --- a/sdk/monitor/azure-monitor-query/swagger/README.PYTHON.md +++ b/sdk/monitor/azure-monitor-query/swagger/README.PYTHON.md @@ -14,10 +14,10 @@ no-namespace-folders: true output-folder: ../azure/monitor/query/_generated source-code-folder-path: ./azure/monitor/query/_generated input-file: - - https://github.com/srnagar/azure-rest-api-specs/blob/a40aabf76646f487ba90350e3e489358d8ab135d/specification/operationalinsights/data-plane/Microsoft.OperationalInsights/preview/2021-05-19_Preview/OperationalInsights.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 + - https://github.com/Azure/azure-rest-api-specs/blob/master/specification/operationalinsights/data-plane/Microsoft.OperationalInsights/preview/2021-05-19_Preview/OperationalInsights.json + - https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metricDefinitions_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metrics_API.json + - https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json modelerfour: lenient-model-deduplication: true python: true From d27c7527c6efc48cd5ceaa4f14d18cbc564922e8 Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Sun, 27 Jun 2021 02:10:56 -0700 Subject: [PATCH 2/5] lint --- sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py index c477de7909c1..5b61aed3eb5f 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py @@ -11,7 +11,7 @@ from ._helpers import order_results, construct_iso8601 from ._generated.models import ( Column as InternalColumn, - LogQueryRequest as InternalLogQueryRequest, + BatchQueryRequest as InternalLogQueryRequest, ) From 01ea5c035ae159ee83b8520ea95222c1fd3deb10 Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Sun, 27 Jun 2021 02:30:58 -0700 Subject: [PATCH 3/5] link --- sdk/monitor/azure-monitor-query/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 1ce925928ba6..765c2ccb3b2e 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -269,7 +269,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [python-query-src]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/monitor/azure-monitor-query/ [python-query-pypi]: https://aka.ms/azsdk-python-monitor-query-pypi [python-query-product-docs]: https://docs.microsoft.com/azure/azure-monitor/ -[python-query-ref-docs]: https://docs.microsoft.com/python/api/overview/azure/?view=azure-python +[python-query-ref-docs]: https://docs.microsoft.com/en-us/python/api/overview/azure/monitor-query-readme?view=azure-python-preview [python-query-samples]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/monitor/azure-monitor-query/samples [python-query-changelog]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/monitor/azure-monitor-query/CHANGELOG.md [pip]: https://pypi.org/project/pip/ From 373eb78dc58a95c424b81c9117015278edb8c8fe Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Sun, 27 Jun 2021 03:08:22 -0700 Subject: [PATCH 4/5] Update sdk/monitor/azure-monitor-query/README.md --- sdk/monitor/azure-monitor-query/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 83e058235b40..3665b265966b 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -269,7 +269,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [python-query-src]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-query/ [python-query-pypi]: https://aka.ms/azsdk-python-monitor-query-pypi [python-query-product-docs]: https://docs.microsoft.com/azure/azure-monitor/ -[python-query-ref-docs]: https://docs.microsoft.com/en-us/python/api/overview/azure/monitor-query-readme?view=azure-python-preview +[python-query-ref-docs]: https://docs.microsoft.com/python/api/overview/azure/monitor-query-readme?view=azure-python-preview [python-query-samples]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/monitor/azure-monitor-query/samples [python-query-changelog]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/monitor/azure-monitor-query/CHANGELOG.md [pip]: https://pypi.org/project/pip/ From c1f8e3481d66f3ebb695a2b435b42888eda5afa3 Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Mon, 28 Jun 2021 01:58:54 -0700 Subject: [PATCH 5/5] Update sdk/monitor/azure-monitor-query/README.md --- sdk/monitor/azure-monitor-query/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 3665b265966b..d78578544aa5 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -270,8 +270,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [python-query-pypi]: https://aka.ms/azsdk-python-monitor-query-pypi [python-query-product-docs]: https://docs.microsoft.com/azure/azure-monitor/ [python-query-ref-docs]: https://docs.microsoft.com/python/api/overview/azure/monitor-query-readme?view=azure-python-preview -[python-query-samples]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/monitor/azure-monitor-query/samples -[python-query-changelog]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/monitor/azure-monitor-query/CHANGELOG.md +[python-query-samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-query/samples +[python-query-changelog]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-query/CHANGELOG.md [pip]: https://pypi.org/project/pip/ [azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions