Skip to content
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
1 change: 1 addition & 0 deletions eng/.docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ known_content_issues:
- ['sdk/core/azure-nspkg/README.md', '#4554']
- ['sdk/core/azure-servicemanagement-legacy/README.md', '#4554']
- ['sdk/eventgrid/azure-eventgrid/README.md', '#4554']
- ['sdk/monitor/azure-monitor-query/README.md', '#4554']
- ['sdk/graphrbac/azure-graphrbac/README.md', '#4554']
- ['sdk/loganalytics/azure-loganalytics/README.md', '#4554']
- ['sdk/schemaregistry/azure-schemaregistry/swagger/README.md', '#4554']
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
3 changes: 3 additions & 0 deletions sdk/monitor/azure-monitor-query/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Release History

## 1.0.0b1 (Unreleased)
5 changes: 5 additions & 0 deletions sdk/monitor/azure-monitor-query/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-include tests *.py *.yaml
recursive-include samples *.py
include *.md
include azure/__init__.py
include azure/monitor/__init__.py
3 changes: 3 additions & 0 deletions sdk/monitor/azure-monitor-query/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Azure Monitor Query client library for Python

TODO
1 change: 1 addition & 0 deletions sdk/monitor/azure-monitor-query/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
1 change: 1 addition & 0 deletions sdk/monitor/azure-monitor-query/azure/monitor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
37 changes: 37 additions & 0 deletions sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------

from ._log_query_client import LogsClient
from ._metrics_query_client import MetricsClient

from ._models import (
LogsQueryResults,
LogsQueryResultTable,
LogsQueryResultColumn,
MetricsResponse,
LogsQueryRequest,
LogsQueryBody,
LogsBatchResponse
)

from ._generated.models import MetricNamespaceCollection

from ._version import VERSION

__all__ = [
"LogsClient",
"LogsBatchResponse",
"LogsQueryResults",
"LogsQueryResultColumn",
"LogsQueryResultTable",
"LogsQueryRequest",
"LogsQueryBody",
"MetricsClient",
"MetricsResponse",
"MetricNamespaceCollection"
]

__version__ = VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._monitor_query_client import MonitorQueryClient
__all__ = ['MonitorQueryClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

VERSION = "unknown"

class MonitorQueryClientConfiguration(Configuration):
"""Configuration for MonitorQueryClient.

Note that all parameters used to create this instance are saved as instance
attributes.

:param host: server parameter.
:type host: str
"""

def __init__(
self,
host="https://management.azure.com", # type: str
**kwargs # type: Any
):
# type: (...) -> None
if host is None:
raise ValueError("Parameter 'host' must not be None.")
super(MonitorQueryClientConfiguration, self).__init__(**kwargs)

self.host = host
kwargs.setdefault('sdk_moniker', 'monitorqueryclient/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from azure.core import PipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import MonitorQueryClientConfiguration
from .operations import QueryOperations
from .operations import MetadataOperations
from .operations import MetricDefinitionsOperations
from .operations import MetricNamespacesOperations
from .operations import MetricsOperations
from . import models


class MonitorQueryClient(object):
"""Azure Monitor Query Python Client.

:ivar query: QueryOperations operations
:vartype query: monitor_query_client.operations.QueryOperations
:ivar metadata: MetadataOperations operations
:vartype metadata: monitor_query_client.operations.MetadataOperations
:ivar metric_definitions: MetricDefinitionsOperations operations
:vartype metric_definitions: monitor_query_client.operations.MetricDefinitionsOperations
:ivar metric_namespaces: MetricNamespacesOperations operations
:vartype metric_namespaces: monitor_query_client.operations.MetricNamespacesOperations
:ivar metrics: MetricsOperations operations
:vartype metrics: monitor_query_client.operations.MetricsOperations
:param host: server parameter.
:type host: str
:param str base_url: Service URL
"""

def __init__(
self,
host="https://management.azure.com", # type: str
base_url=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
if not base_url:
base_url = 'https://api.loganalytics.io/v1'
self._config = MonitorQueryClientConfiguration(host, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.query = QueryOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metadata = MetadataOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metric_definitions = MetricDefinitionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metric_namespaces = MetricNamespacesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metrics = MetricsOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.

:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
http_request.url = self._client.format_url(http_request.url)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
self._client.close()

def __enter__(self):
# type: () -> MonitorQueryClient
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._monitor_query_client import MonitorQueryClient
__all__ = ['MonitorQueryClient']
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

VERSION = "unknown"

class MonitorQueryClientConfiguration(Configuration):
"""Configuration for MonitorQueryClient.

Note that all parameters used to create this instance are saved as instance
attributes.

:param host: server parameter.
:type host: str
"""

def __init__(
self,
host: str = "https://management.azure.com",
**kwargs: Any
) -> None:
if host is None:
raise ValueError("Parameter 'host' must not be None.")
super(MonitorQueryClientConfiguration, self).__init__(**kwargs)

self.host = host
kwargs.setdefault('sdk_moniker', 'monitorqueryclient/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any, Optional

from azure.core import AsyncPipelineClient
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from msrest import Deserializer, Serializer

from ._configuration import MonitorQueryClientConfiguration
from .operations import QueryOperations
from .operations import MetadataOperations
from .operations import MetricDefinitionsOperations
from .operations import MetricNamespacesOperations
from .operations import MetricsOperations
from .. import models


class MonitorQueryClient(object):
"""Azure Monitor Query Python Client.

:ivar query: QueryOperations operations
:vartype query: monitor_query_client.aio.operations.QueryOperations
:ivar metadata: MetadataOperations operations
:vartype metadata: monitor_query_client.aio.operations.MetadataOperations
:ivar metric_definitions: MetricDefinitionsOperations operations
:vartype metric_definitions: monitor_query_client.aio.operations.MetricDefinitionsOperations
:ivar metric_namespaces: MetricNamespacesOperations operations
:vartype metric_namespaces: monitor_query_client.aio.operations.MetricNamespacesOperations
:ivar metrics: MetricsOperations operations
:vartype metrics: monitor_query_client.aio.operations.MetricsOperations
:param host: server parameter.
:type host: str
:param str base_url: Service URL
"""

def __init__(
self,
host: str = "https://management.azure.com",
base_url: Optional[str] = None,
**kwargs: Any
) -> None:
if not base_url:
base_url = 'https://api.loganalytics.io/v1'
self._config = MonitorQueryClientConfiguration(host, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.query = QueryOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metadata = MetadataOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metric_definitions = MetricDefinitionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metric_namespaces = MetricNamespacesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.metrics = MetricsOperations(
self._client, self._config, self._serialize, self._deserialize)

async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.

:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
http_request.url = self._client.format_url(http_request.url)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "MonitorQueryClient":
await self._client.__aenter__()
return self

async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
Loading