|
5 | 5 | # license information. |
6 | 6 | # -------------------------------------------------------------------------- |
7 | 7 |
|
8 | | -from typing import TYPE_CHECKING, Any, Union, Sequence, Dict, List, cast |
| 8 | +from typing import TYPE_CHECKING, Any, Union, Sequence, Dict, List, cast, Tuple |
| 9 | +from datetime import timedelta, datetime |
9 | 10 | from azure.core.exceptions import HttpResponseError |
10 | 11 | from azure.core.tracing.decorator import distributed_trace |
11 | 12 |
|
|
24 | 25 |
|
25 | 26 | if TYPE_CHECKING: |
26 | 27 | from azure.core.credentials import TokenCredential |
27 | | - from datetime import timedelta, datetime |
28 | 28 |
|
29 | 29 |
|
30 | 30 | class LogsQueryClient(object): # pylint: disable=client-accepts-api-version-keyword |
@@ -66,8 +66,16 @@ def __init__(self, credential, **kwargs): |
66 | 66 | self._query_op = self._client.query |
67 | 67 |
|
68 | 68 | @distributed_trace |
69 | | - def query_workspace(self, workspace_id, query, **kwargs): |
70 | | - # type: (str, str, Any) -> Union[LogsQueryResult, LogsQueryPartialResult] |
| 69 | + def query_workspace( |
| 70 | + self, |
| 71 | + workspace_id: str, |
| 72 | + query: str, |
| 73 | + *, |
| 74 | + timespan: Union[ |
| 75 | + timedelta, Tuple[datetime, timedelta], Tuple[datetime, datetime] |
| 76 | + ], |
| 77 | + **kwargs: Any |
| 78 | + ) -> Union[LogsQueryResult, LogsQueryPartialResult]: |
71 | 79 | """Execute a Kusto query. |
72 | 80 |
|
73 | 81 | Executes a Kusto query for data. |
@@ -104,11 +112,7 @@ def query_workspace(self, workspace_id, query, **kwargs): |
104 | 112 | :dedent: 0 |
105 | 113 | :caption: Get a response for a single Log Query |
106 | 114 | """ |
107 | | - if "timespan" not in kwargs: |
108 | | - raise TypeError( |
109 | | - "query() missing 1 required keyword-only argument: 'timespan'" |
110 | | - ) |
111 | | - timespan = construct_iso8601(kwargs.pop("timespan")) |
| 115 | + timespan = construct_iso8601(timespan) |
112 | 116 | include_statistics = kwargs.pop("include_statistics", False) |
113 | 117 | include_visualization = kwargs.pop("include_visualization", False) |
114 | 118 | server_timeout = kwargs.pop("server_timeout", None) |
|
0 commit comments