Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate code with latest commit #19512

Merged
merged 6 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 13 additions & 37 deletions sdk/monitor/azure-monitor-query/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -293,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/python/api/overview/azure/?view=azure-python
[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/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/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:`<br>`Example::code:`<br>`Metric contains metadata A, B and C.:code:`<br>`-
Return all time series of C where A = a1 and B = b1 or b2:code:`<br>`\ **$filter=A eq ‘a1’ and
B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**\ :code:`<br>`- Invalid variant::code:`<br>`\ **$filter=A
eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**\ :code:`<br>`This is invalid because the
logical or operator cannot separate two different metadata names.:code:`<br>`- Return all time
series where A = a1, B = b1 and C = c1::code:`<br>`\ **$filter=A eq ‘a1’ and B eq ‘b1’ and C eq
‘c1’**\ :code:`<br>`- Return all time series where A = a1:code:`<br>`\ **$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.
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ async def execute(
:param body: The Analytics query. Learn more about the `Analytics query syntax
<https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/>`_.
: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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -120,9 +125,6 @@
'ErrorResponse',
'ErrorResponseAutoGenerated',
'LocalizableString',
'LogQueryRequest',
'LogQueryResponse',
'LogQueryResult',
'MetadataApplication',
'MetadataApplicationRelated',
'MetadataCategory',
Expand Down Expand Up @@ -160,8 +162,10 @@
'Table',
'TimeSeriesElement',
'AggregationType',
'ColumnDataType',
'LogsColumnType',
'MetadataColumnDataType',
'MetricClass',
'MetricUnit',
'NamespaceClassification',
'ResultType',
'Unit',
]
Loading