From 72d32862a62ee4753837a22d2561a5dadb757a80 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Wed, 25 Jul 2018 14:10:03 -0700 Subject: [PATCH 01/23] Initial extension commit --- .../azext_loganalytics/__init__.py | 36 +++++ .../azext_loganalytics/_client_factory.py | 14 ++ src/loganalytics/azext_loganalytics/_help.py | 28 ++++ .../azext_loganalytics/_params.py | 14 ++ .../azext_loganalytics/azext_metadata.json | 3 + .../azext_loganalytics/commands.py | 20 +++ src/loganalytics/azext_loganalytics/custom.py | 14 ++ .../loganalytics/__init__.py | 18 +++ .../loganalytics/log_analytics_data_client.py | 132 ++++++++++++++++++ .../loganalytics/models/__init__.py | 37 +++++ .../loganalytics/models/column.py | 34 +++++ .../loganalytics/models/column_py3.py | 34 +++++ .../loganalytics/models/error_detail.py | 58 ++++++++ .../loganalytics/models/error_detail_py3.py | 58 ++++++++ .../loganalytics/models/error_info.py | 51 +++++++ .../loganalytics/models/error_info_py3.py | 51 +++++++ .../loganalytics/models/error_response.py | 49 +++++++ .../loganalytics/models/error_response_py3.py | 49 +++++++ .../loganalytics/models/query_body.py | 45 ++++++ .../loganalytics/models/query_body_py3.py | 45 ++++++ .../loganalytics/models/query_results.py | 36 +++++ .../loganalytics/models/query_results_py3.py | 36 +++++ .../loganalytics/models/table.py | 46 ++++++ .../loganalytics/models/table_py3.py | 46 ++++++ .../loganalytics/version.py | 13 ++ .../azext_loganalytics/tests/__init__.py | 4 + .../tests/latest/__init__.py | 4 + .../tests/latest/recordings/test_query.yaml | 63 +++++++++ .../latest/test_loganalytics_commands.py | 19 +++ src/loganalytics/setup.cfg | 2 + src/loganalytics/setup.py | 42 ++++++ 31 files changed, 1101 insertions(+) create mode 100644 src/loganalytics/azext_loganalytics/__init__.py create mode 100644 src/loganalytics/azext_loganalytics/_client_factory.py create mode 100644 src/loganalytics/azext_loganalytics/_help.py create mode 100644 src/loganalytics/azext_loganalytics/_params.py create mode 100644 src/loganalytics/azext_loganalytics/azext_metadata.json create mode 100644 src/loganalytics/azext_loganalytics/commands.py create mode 100644 src/loganalytics/azext_loganalytics/custom.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/__init__.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/log_analytics_data_client.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/__init__.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/column.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/column_py3.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/error_detail.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/error_detail_py3.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/error_info.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/error_info_py3.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/error_response.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/error_response_py3.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/query_body.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/query_body_py3.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/query_results.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/query_results_py3.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/table.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/models/table_py3.py create mode 100644 src/loganalytics/azext_loganalytics/loganalytics/version.py create mode 100644 src/loganalytics/azext_loganalytics/tests/__init__.py create mode 100644 src/loganalytics/azext_loganalytics/tests/latest/__init__.py create mode 100644 src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml create mode 100644 src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py create mode 100644 src/loganalytics/setup.cfg create mode 100644 src/loganalytics/setup.py diff --git a/src/loganalytics/azext_loganalytics/__init__.py b/src/loganalytics/azext_loganalytics/__init__.py new file mode 100644 index 00000000000..8678dabb6d9 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/__init__.py @@ -0,0 +1,36 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader + +from azext_loganalytics._help import helps # pylint: disable=unused-import + + +class LogAnalyticsCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_loganalytics._client_factory import loganalytics_data_plane_client + loganalytics_custom = CliCommandType( + operations_tmpl='azext_loganalytics.custom#{}', + client_factory=loganalytics_data_plane_client + ) + + super(LogAnalyticsCommandsLoader, self).__init__( + cli_ctx=cli_ctx, + custom_command_type=loganalytics_custom + ) + + def load_command_table(self, args): + from azext_loganalytics.commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_loganalytics._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = LogAnalyticsCommandsLoader diff --git a/src/loganalytics/azext_loganalytics/_client_factory.py b/src/loganalytics/azext_loganalytics/_client_factory.py new file mode 100644 index 00000000000..ba8d64b1ec9 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/_client_factory.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def loganalytics_data_plane_client(cli_ctx, _): + """Initialize Log Analytics data client for use with CLI.""" + from .loganalytics import LogAnalyticsDataClient + from azure.cli.core._profile import Profile + profile = Profile(cli_ctx=cli_ctx) + cred, _, _ = profile.get_login_credentials( + resource="https://api.loganalytics.io") + return LogAnalyticsDataClient(cred) diff --git a/src/loganalytics/azext_loganalytics/_help.py b/src/loganalytics/azext_loganalytics/_help.py new file mode 100644 index 00000000000..b07dfb3476f --- /dev/null +++ b/src/loganalytics/azext_loganalytics/_help.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.help_files import helps + +# pylint: disable=line-too-long + +helps['loganalytics query'] = """ + type: command + short-summary: Query a Log Analytics workspace. + parameters: + - workspace: --workspace -w + type: string + short-summary: GUID of the Log Analytics workspace. + - kql: --kql -k + type: string + short-summary: Query to execute over the Log Analytics data. + - timespan: --timespan -t + type: string + short-summary: Timespan over which to query data. Defaults to all data. + - workspaces: --workspaces + type: array + short-summary: Additional workspaces to union data for querying. Specify additional workspace IDs separated by commas. + examples: + - name: +""" diff --git a/src/loganalytics/azext_loganalytics/_params.py b/src/loganalytics/azext_loganalytics/_params.py new file mode 100644 index 00000000000..307406c869d --- /dev/null +++ b/src/loganalytics/azext_loganalytics/_params.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long + + +def load_arguments(self, _): + with self.argument_context('loganalytics') as c: + c.argument('workspace', options_list=['--workspace', '-w'], help='GUID of the Log Analytics Workspace', required=True) + c.argument('kql', help='Query to execute over Log Analytics data.', required=True) + c.argument('timespan', options_list=['--timespan', '-t'], help='Timespan over which to query. Defaults to querying all available data.') + c.argument('workspaces', nargs='+', help='Optional additional workspaces over which to join data for the query.') diff --git a/src/loganalytics/azext_loganalytics/azext_metadata.json b/src/loganalytics/azext_loganalytics/azext_metadata.json new file mode 100644 index 00000000000..a2f37531f6a --- /dev/null +++ b/src/loganalytics/azext_loganalytics/azext_metadata.json @@ -0,0 +1,3 @@ +{ + "azext.isPreview": true +} \ No newline at end of file diff --git a/src/loganalytics/azext_loganalytics/commands.py b/src/loganalytics/azext_loganalytics/commands.py new file mode 100644 index 00000000000..e00616a25a7 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/commands.py @@ -0,0 +1,20 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long + + +def load_command_table(self, _): + + from azure.cli.core.commands import CliCommandType + from azext_loganalytics._client_factory import loganalytics_data_plane_client + + loganalytics_sdk = CliCommandType( + operations_tmpl='azext_loganalytics.custom#{}', + client_factory=loganalytics_data_plane_client + ) + + with self.command_group('loganalytics', loganalytics_sdk) as g: + g.command('query', 'execute_query') diff --git a/src/loganalytics/azext_loganalytics/custom.py b/src/loganalytics/azext_loganalytics/custom.py new file mode 100644 index 00000000000..605180eb0d7 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.log import get_logger + +logger = get_logger(__name__) + + +def execute_query(client, workspace, kql, timespan=None, workspaces=None): + """Executes a query against the provided Log Analytics workspace.""" + from .loganalytics.models import QueryBody + return client.query(workspace, QueryBody(query=kql, timespan=timespan, workspaces=workspaces)) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/__init__.py b/src/loganalytics/azext_loganalytics/loganalytics/__init__.py new file mode 100644 index 00000000000..b26c9dd6478 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/__init__.py @@ -0,0 +1,18 @@ +# 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 .log_analytics_data_client import LogAnalyticsDataClient +from .version import VERSION + +__all__ = ['LogAnalyticsDataClient'] + +__version__ = VERSION + diff --git a/src/loganalytics/azext_loganalytics/loganalytics/log_analytics_data_client.py b/src/loganalytics/azext_loganalytics/loganalytics/log_analytics_data_client.py new file mode 100644 index 00000000000..75521bb6886 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/log_analytics_data_client.py @@ -0,0 +1,132 @@ +# 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 msrest.service_client import SDKClient +from msrest import Configuration, Serializer, Deserializer +from .version import VERSION +from msrest.pipeline import ClientRawResponse +from . import models + + +class LogAnalyticsDataClientConfiguration(Configuration): + """Configuration for LogAnalyticsDataClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'https://api.loganalytics.io/v1' + + super(LogAnalyticsDataClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-loganalytics/{}'.format(VERSION)) + + self.credentials = credentials + + +class LogAnalyticsDataClient(SDKClient): + """Log Analytics Data Plane Client + + :ivar config: Configuration for client. + :vartype config: LogAnalyticsDataClientConfiguration + + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = LogAnalyticsDataClientConfiguration(credentials, base_url) + super(LogAnalyticsDataClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = 'v1' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + + def query( + self, workspace_id, body, custom_headers=None, raw=False, **operation_config): + """Execute an Analytics query. + + Executes an Analytics query for data. + [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an + example for using POST with an Analytics query. + + :param workspace_id: ID of the workspace. This is Workspace ID from + the Properties blade in the Azure portal. + :type workspace_id: str + :param body: The Analytics query. Learn more about the [Analytics + query + syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + :type body: ~azure.loganalytics.models.QueryBody + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QueryResults or ClientRawResponse if raw=true + :rtype: ~azure.loganalytics.models.QueryResults or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.query.metadata['url'] + path_format_arguments = { + 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'QueryBody') + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('QueryResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + query.metadata = {'url': '/workspaces/{workspaceId}/query'} diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/__init__.py b/src/loganalytics/azext_loganalytics/loganalytics/models/__init__.py new file mode 100644 index 00000000000..14fa816d7ba --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/__init__.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from .query_body_py3 import QueryBody + from .column_py3 import Column + from .table_py3 import Table + from .query_results_py3 import QueryResults + from .error_detail_py3 import ErrorDetail + from .error_info_py3 import ErrorInfo + from .error_response_py3 import ErrorResponse, ErrorResponseException +except (SyntaxError, ImportError): + from .query_body import QueryBody + from .column import Column + from .table import Table + from .query_results import QueryResults + from .error_detail import ErrorDetail + from .error_info import ErrorInfo + from .error_response import ErrorResponse, ErrorResponseException + +__all__ = [ + 'QueryBody', + 'Column', + 'Table', + 'QueryResults', + 'ErrorDetail', + 'ErrorInfo', + 'ErrorResponse', 'ErrorResponseException', +] diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/column.py b/src/loganalytics/azext_loganalytics/loganalytics/models/column.py new file mode 100644 index 00000000000..fde9b294d35 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/column.py @@ -0,0 +1,34 @@ +# 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 msrest.serialization import Model + + +class Column(Model): + """A table column. + + A column in a table. + + :param name: The name of this column. + :type name: str + :param type: The data type of this column. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Column, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/column_py3.py b/src/loganalytics/azext_loganalytics/loganalytics/models/column_py3.py new file mode 100644 index 00000000000..4df2ac58398 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/column_py3.py @@ -0,0 +1,34 @@ +# 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 msrest.serialization import Model + + +class Column(Model): + """A table column. + + A column in a table. + + :param name: The name of this column. + :type name: str + :param type: The data type of this column. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + super(Column, self).__init__(**kwargs) + self.name = name + self.type = type diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail.py b/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail.py new file mode 100644 index 00000000000..3fd620dffa4 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail.py @@ -0,0 +1,58 @@ +# 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 msrest.serialization import Model + + +class ErrorDetail(Model): + """Error details. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. The error's code. + :type code: str + :param message: Required. A human readable error message. + :type message: str + :param target: Indicates which property in the request is responsible for + the error. + :type target: str + :param value: Indicates which value in 'target' is responsible for the + error. + :type value: str + :param resources: Indicates resources which were responsible for the + error. + :type resources: list[str] + :param additional_properties: + :type additional_properties: object + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + 'additional_properties': {'key': 'additionalProperties', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.value = kwargs.get('value', None) + self.resources = kwargs.get('resources', None) + self.additional_properties = kwargs.get('additional_properties', None) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail_py3.py b/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail_py3.py new file mode 100644 index 00000000000..8c714de89d1 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail_py3.py @@ -0,0 +1,58 @@ +# 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 msrest.serialization import Model + + +class ErrorDetail(Model): + """Error details. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. The error's code. + :type code: str + :param message: Required. A human readable error message. + :type message: str + :param target: Indicates which property in the request is responsible for + the error. + :type target: str + :param value: Indicates which value in 'target' is responsible for the + error. + :type value: str + :param resources: Indicates resources which were responsible for the + error. + :type resources: list[str] + :param additional_properties: + :type additional_properties: object + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + 'additional_properties': {'key': 'additionalProperties', 'type': 'object'}, + } + + def __init__(self, *, code: str, message: str, target: str=None, value: str=None, resources=None, additional_properties=None, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.value = value + self.resources = resources + self.additional_properties = additional_properties diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_info.py b/src/loganalytics/azext_loganalytics/loganalytics/models/error_info.py new file mode 100644 index 00000000000..60b1bff092d --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/error_info.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ErrorInfo(Model): + """The code and message for an error. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. A machine readable error code. + :type code: str + :param message: Required. A human readable error message. + :type message: str + :param details: error details. + :type details: list[~azure.loganalytics.models.ErrorDetail] + :param innererror: Inner error details if they exist. + :type innererror: ~azure.loganalytics.models.ErrorInfo + :param additional_properties: + :type additional_properties: object + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'innererror': {'key': 'innererror', 'type': 'ErrorInfo'}, + 'additional_properties': {'key': 'additionalProperties', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorInfo, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = kwargs.get('details', None) + self.innererror = kwargs.get('innererror', None) + self.additional_properties = kwargs.get('additional_properties', None) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_info_py3.py b/src/loganalytics/azext_loganalytics/loganalytics/models/error_info_py3.py new file mode 100644 index 00000000000..1692b9d1696 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/error_info_py3.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ErrorInfo(Model): + """The code and message for an error. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. A machine readable error code. + :type code: str + :param message: Required. A human readable error message. + :type message: str + :param details: error details. + :type details: list[~azure.loganalytics.models.ErrorDetail] + :param innererror: Inner error details if they exist. + :type innererror: ~azure.loganalytics.models.ErrorInfo + :param additional_properties: + :type additional_properties: object + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'innererror': {'key': 'innererror', 'type': 'ErrorInfo'}, + 'additional_properties': {'key': 'additionalProperties', 'type': 'object'}, + } + + def __init__(self, *, code: str, message: str, details=None, innererror=None, additional_properties=None, **kwargs) -> None: + super(ErrorInfo, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = details + self.innererror = innererror + self.additional_properties = additional_properties diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_response.py b/src/loganalytics/azext_loganalytics/loganalytics/models/error_response.py new file mode 100644 index 00000000000..8ecb3f3ed70 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/error_response.py @@ -0,0 +1,49 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorResponse(Model): + """Error details. + + Contains details when the response code indicates an error. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. The error details. + :type error: ~azure.loganalytics.models.ErrorInfo + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorInfo'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_response_py3.py b/src/loganalytics/azext_loganalytics/loganalytics/models/error_response_py3.py new file mode 100644 index 00000000000..d12bb2b0a34 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/error_response_py3.py @@ -0,0 +1,49 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorResponse(Model): + """Error details. + + Contains details when the response code indicates an error. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. The error details. + :type error: ~azure.loganalytics.models.ErrorInfo + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorInfo'}, + } + + def __init__(self, *, error, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_body.py b/src/loganalytics/azext_loganalytics/loganalytics/models/query_body.py new file mode 100644 index 00000000000..255d440bed4 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/query_body.py @@ -0,0 +1,45 @@ +# 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 msrest.serialization import Model + + +class QueryBody(Model): + """The Analytics query. Learn more about the [Analytics query + syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/). + + All required parameters must be populated in order to send to Azure. + + :param query: Required. The query to execute. + :type query: str + :param timespan: Optional. The timespan over which to query data. This is + an ISO8601 time period value. This timespan is applied in addition to any + that are specified in the query expression. + :type timespan: str + :param workspaces: A list of workspaces that are included in the query. + :type workspaces: list[str] + """ + + _validation = { + 'query': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(QueryBody, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.timespan = kwargs.get('timespan', None) + self.workspaces = kwargs.get('workspaces', None) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_body_py3.py b/src/loganalytics/azext_loganalytics/loganalytics/models/query_body_py3.py new file mode 100644 index 00000000000..65d455bd010 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/query_body_py3.py @@ -0,0 +1,45 @@ +# 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 msrest.serialization import Model + + +class QueryBody(Model): + """The Analytics query. Learn more about the [Analytics query + syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/). + + All required parameters must be populated in order to send to Azure. + + :param query: Required. The query to execute. + :type query: str + :param timespan: Optional. The timespan over which to query data. This is + an ISO8601 time period value. This timespan is applied in addition to any + that are specified in the query expression. + :type timespan: str + :param workspaces: A list of workspaces that are included in the query. + :type workspaces: list[str] + """ + + _validation = { + 'query': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'timespan': {'key': 'timespan', 'type': 'str'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + } + + def __init__(self, *, query: str, timespan: str=None, workspaces=None, **kwargs) -> None: + super(QueryBody, self).__init__(**kwargs) + self.query = query + self.timespan = timespan + self.workspaces = workspaces diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_results.py b/src/loganalytics/azext_loganalytics/loganalytics/models/query_results.py new file mode 100644 index 00000000000..a13f3c811b7 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/query_results.py @@ -0,0 +1,36 @@ +# 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 msrest.serialization import Model + + +class QueryResults(Model): + """A query response. + + Contains the tables, columns & rows resulting from a query. + + All required parameters must be populated in order to send to Azure. + + :param tables: Required. The list of tables, columns and rows. + :type tables: list[~azure.loganalytics.models.Table] + """ + + _validation = { + 'tables': {'required': True}, + } + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[Table]'}, + } + + def __init__(self, **kwargs): + super(QueryResults, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_results_py3.py b/src/loganalytics/azext_loganalytics/loganalytics/models/query_results_py3.py new file mode 100644 index 00000000000..a9265f7bcbf --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/query_results_py3.py @@ -0,0 +1,36 @@ +# 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 msrest.serialization import Model + + +class QueryResults(Model): + """A query response. + + Contains the tables, columns & rows resulting from a query. + + All required parameters must be populated in order to send to Azure. + + :param tables: Required. The list of tables, columns and rows. + :type tables: list[~azure.loganalytics.models.Table] + """ + + _validation = { + 'tables': {'required': True}, + } + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[Table]'}, + } + + def __init__(self, *, tables, **kwargs) -> None: + super(QueryResults, self).__init__(**kwargs) + self.tables = tables diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/table.py b/src/loganalytics/azext_loganalytics/loganalytics/models/table.py new file mode 100644 index 00000000000..69989740957 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/table.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class Table(Model): + """A query response table. + + Contains the columns and rows for one table in a query response. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the table. + :type name: str + :param columns: Required. The list of columns in this table. + :type columns: list[~azure.loganalytics.models.Column] + :param rows: Required. The resulting rows from this query. + :type rows: list[list[object]] + """ + + _validation = { + 'name': {'required': True}, + 'columns': {'required': True}, + 'rows': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'rows': {'key': 'rows', 'type': '[[object]]'}, + } + + def __init__(self, **kwargs): + super(Table, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.columns = kwargs.get('columns', None) + self.rows = kwargs.get('rows', None) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/table_py3.py b/src/loganalytics/azext_loganalytics/loganalytics/models/table_py3.py new file mode 100644 index 00000000000..dc7dbe3e09b --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/models/table_py3.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class Table(Model): + """A query response table. + + Contains the columns and rows for one table in a query response. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the table. + :type name: str + :param columns: Required. The list of columns in this table. + :type columns: list[~azure.loganalytics.models.Column] + :param rows: Required. The resulting rows from this query. + :type rows: list[list[object]] + """ + + _validation = { + 'name': {'required': True}, + 'columns': {'required': True}, + 'rows': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'columns': {'key': 'columns', 'type': '[Column]'}, + 'rows': {'key': 'rows', 'type': '[[object]]'}, + } + + def __init__(self, *, name: str, columns, rows, **kwargs) -> None: + super(Table, self).__init__(**kwargs) + self.name = name + self.columns = columns + self.rows = rows diff --git a/src/loganalytics/azext_loganalytics/loganalytics/version.py b/src/loganalytics/azext_loganalytics/loganalytics/version.py new file mode 100644 index 00000000000..e0ec669828c --- /dev/null +++ b/src/loganalytics/azext_loganalytics/loganalytics/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + diff --git a/src/loganalytics/azext_loganalytics/tests/__init__.py b/src/loganalytics/azext_loganalytics/tests/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/loganalytics/azext_loganalytics/tests/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/loganalytics/azext_loganalytics/tests/latest/__init__.py b/src/loganalytics/azext_loganalytics/tests/latest/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/loganalytics/azext_loganalytics/tests/latest/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml b/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml new file mode 100644 index 00000000000..79cf787ae4b --- /dev/null +++ b/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml @@ -0,0 +1,63 @@ +interactions: +- request: + body: '{"query": "Heartbeat | getschema"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['34'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.3 + azure-loganalytics/0.1.0] + method: POST + uri: https://api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query + response: + body: {string: '{"tables":[{"name":"getschema","columns":[{"name":"ColumnName","type":"string"},{"name":"ColumnOrdinal","type":"int"},{"name":"DataType","type":"string"},{"name":"ColumnType","type":"string"}],"rows":[["TenantId",0,"System.String","string"],["SourceSystem",1,"System.String","string"],["TimeGenerated",2,"System.DateTime","datetime"],["MG",3,"System.String","string"],["ManagementGroupName",4,"System.String","string"],["SourceComputerId",5,"System.String","string"],["ComputerIP",6,"System.String","string"],["Computer",7,"System.String","string"],["Category",8,"System.String","string"],["OSType",9,"System.String","string"],["OSName",10,"System.String","string"],["OSMajorVersion",11,"System.String","string"],["OSMinorVersion",12,"System.String","string"],["Version",13,"System.String","string"],["SCAgentChannel",14,"System.String","string"],["IsGatewayInstalled",15,"System.SByte","bool"],["RemoteIPLongitude",16,"System.Double","real"],["RemoteIPLatitude",17,"System.Double","real"],["RemoteIPCountry",18,"System.String","string"],["SubscriptionId",19,"System.String","string"],["ResourceGroup",20,"System.String","string"],["ResourceProvider",21,"System.String","string"],["Resource",22,"System.String","string"],["ResourceId",23,"System.String","string"],["ResourceType",24,"System.String","string"],["ComputerEnvironment",25,"System.String","string"],["Solutions",26,"System.String","string"],["VMUUID",27,"System.String","string"],["Type",28,"System.String","string"]]}]}'} + headers: + access-control-allow-origin: ['*'] + access-control-expose-headers: ['Retry-After,Age,WWW-Authenticate,x-resource-identities,x-ms-status-location'] + connection: [keep-alive] + content-length: ['1482'] + content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 16 Jul 2018 18:19:50 GMT'] + server: [nginx] + strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; + includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + via: [1.1 draft-oms-green.9ae239f1-88dc-11e8-aedf-70b3d5800006] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: '{"query": "Heartbeat | getschema"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['34'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.4 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.3 + azure-loganalytics/0.1.0] + method: POST + uri: https://api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query + response: + body: {string: '{"tables":[{"name":"getschema","columns":[{"name":"ColumnName","type":"string"},{"name":"ColumnOrdinal","type":"int"},{"name":"DataType","type":"string"},{"name":"ColumnType","type":"string"}],"rows":[["TenantId",0,"System.String","string"],["SourceSystem",1,"System.String","string"],["TimeGenerated",2,"System.DateTime","datetime"],["MG",3,"System.String","string"],["ManagementGroupName",4,"System.String","string"],["SourceComputerId",5,"System.String","string"],["ComputerIP",6,"System.String","string"],["Computer",7,"System.String","string"],["Category",8,"System.String","string"],["OSType",9,"System.String","string"],["OSName",10,"System.String","string"],["OSMajorVersion",11,"System.String","string"],["OSMinorVersion",12,"System.String","string"],["Version",13,"System.String","string"],["SCAgentChannel",14,"System.String","string"],["IsGatewayInstalled",15,"System.SByte","bool"],["RemoteIPLongitude",16,"System.Double","real"],["RemoteIPLatitude",17,"System.Double","real"],["RemoteIPCountry",18,"System.String","string"],["SubscriptionId",19,"System.String","string"],["ResourceGroup",20,"System.String","string"],["ResourceProvider",21,"System.String","string"],["Resource",22,"System.String","string"],["ResourceId",23,"System.String","string"],["ResourceType",24,"System.String","string"],["ComputerEnvironment",25,"System.String","string"],["Solutions",26,"System.String","string"],["VMUUID",27,"System.String","string"],["Type",28,"System.String","string"]]}]}'} + headers: + access-control-allow-origin: ['*'] + access-control-expose-headers: ['Retry-After,Age,WWW-Authenticate,x-resource-identities,x-ms-status-location'] + age: ['0'] + connection: [keep-alive] + content-length: ['1482'] + content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 16 Jul 2018 18:19:50 GMT'] + server: [nginx] + strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; + includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + via: [1.1 draft-oms-green.c01b97e7-888d-11e8-aedf-70b3d5800006] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +version: 1 diff --git a/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py b/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py new file mode 100644 index 00000000000..f91e172a652 --- /dev/null +++ b/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +from azure.cli.testsdk import ScenarioTest + + +class LogAnalyticsDataClientTests(ScenarioTest): + """Test class for Log Analytics data client.""" + def test_query(self): + """Tests data plane query capabilities for Log Analytics.""" + self.cmd('az loganalytics query -w cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"', checks=[ + self.check('tables[0].rows[0][0]', 'TenantId') + ]) + query_result = self.cmd('az loganalytics query -w cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"').get_output_in_json() + assert len(query_result['tables'][0]['rows']) == 29 + assert isinstance(query_result['tables'][0]['rows'][0][1], (int, float, complex)) diff --git a/src/loganalytics/setup.cfg b/src/loganalytics/setup.cfg new file mode 100644 index 00000000000..3c6e79cf31d --- /dev/null +++ b/src/loganalytics/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py new file mode 100644 index 00000000000..74948454e64 --- /dev/null +++ b/src/loganalytics/setup.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + +VERSION = "0.0.1" + +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +setup( + name='loganalytics', + version=VERSION, + description='Log Analytics data plane query CLI extension', + long_description='Log Analytics data plane query CLI extension', + license='MIT', + author='Ace Eldeib', + author_email='aleldeib@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_loganalytics': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) From 005bccc66f98ac4a5cf0c25f7023c3865b0b122c Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Wed, 25 Jul 2018 14:20:06 -0700 Subject: [PATCH 02/23] Add initial readme, history --- src/loganalytics/HISTORY.rst | 4 ++++ src/loganalytics/README.rst | 2 ++ src/loganalytics/setup.py | 9 +++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 src/loganalytics/HISTORY.rst create mode 100644 src/loganalytics/README.rst diff --git a/src/loganalytics/HISTORY.rst b/src/loganalytics/HISTORY.rst new file mode 100644 index 00000000000..d3fe8370af0 --- /dev/null +++ b/src/loganalytics/HISTORY.rst @@ -0,0 +1,4 @@ +0.1.0 +++++++++++++++++++ + +* Initial release. \ No newline at end of file diff --git a/src/loganalytics/README.rst b/src/loganalytics/README.rst new file mode 100644 index 00000000000..76b7f17c8f7 --- /dev/null +++ b/src/loganalytics/README.rst @@ -0,0 +1,2 @@ +Azure Log Analytics CLI Extension +================================== diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py index 74948454e64..55aa4cc6ab8 100644 --- a/src/loganalytics/setup.py +++ b/src/loganalytics/setup.py @@ -26,11 +26,16 @@ DEPENDENCIES = [] +with open('README.rst', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + setup( name='loganalytics', version=VERSION, - description='Log Analytics data plane query CLI extension', - long_description='Log Analytics data plane query CLI extension', + description='Support for Azure Log Analytics query capabilities.', + long_description=README + '\n\n' + HISTORY, license='MIT', author='Ace Eldeib', author_email='aleldeib@microsoft.com', From 05a84d4b7f65adb96546d833d69b6c42b03e567c Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 26 Jul 2018 13:27:55 -0700 Subject: [PATCH 03/23] vendor sdk, change imports, update text, and update index --- src/index.json | 46 +++++++++++++++++++ src/loganalytics/HISTORY.rst | 2 +- src/loganalytics/README.rst | 4 +- .../azext_loganalytics/_client_factory.py | 2 +- src/loganalytics/azext_loganalytics/custom.py | 2 +- .../loganalytics/__init__.py | 0 .../loganalytics/log_analytics_data_client.py | 0 .../loganalytics/models/__init__.py | 0 .../loganalytics/models/column.py | 0 .../loganalytics/models/column_py3.py | 0 .../loganalytics/models/error_detail.py | 0 .../loganalytics/models/error_detail_py3.py | 0 .../loganalytics/models/error_info.py | 0 .../loganalytics/models/error_info_py3.py | 0 .../loganalytics/models/error_response.py | 0 .../loganalytics/models/error_response_py3.py | 0 .../loganalytics/models/query_body.py | 0 .../loganalytics/models/query_body_py3.py | 0 .../loganalytics/models/query_results.py | 0 .../loganalytics/models/query_results_py3.py | 0 .../loganalytics/models/table.py | 0 .../loganalytics/models/table_py3.py | 0 .../loganalytics/version.py | 0 src/loganalytics/setup.py | 4 +- 24 files changed, 53 insertions(+), 7 deletions(-) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/__init__.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/log_analytics_data_client.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/__init__.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/column.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/column_py3.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/error_detail.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/error_detail_py3.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/error_info.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/error_info_py3.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/error_response.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/error_response_py3.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/query_body.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/query_body_py3.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/query_results.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/query_results_py3.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/table.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/models/table_py3.py (100%) rename src/loganalytics/azext_loganalytics/{ => vendored_sdks}/loganalytics/version.py (100%) diff --git a/src/index.json b/src/index.json index fac0c13a847..78e7acf6bed 100644 --- a/src/index.json +++ b/src/index.json @@ -951,6 +951,52 @@ "version": "0.9.1" } } + ], + "loganalytics": [ + { + "filename": "azure_loganalytics_cli_extension-1.0.0rc1-py2.py3-none-any.whl", + "sha256Digest": "5ad067ff88db9205c45f7498e2599d78906f20ff2364803aebc52a0a568a7018", + "downloadUrl": "https://files.pythonhosted.org/packages/60/c1/0dd5914b638d39ef0047ea1f5fb2a590d4e65b5822a23a2baac67441f226/azure_loganalytics_cli_extension-1.0.0rc1-py2.py3-none-any.whl", + "metadata": { + "azext.isPreview": true, + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "License :: OSI Approved :: MIT License" + ], + "extensions": { + "python.details": { + "contacts": [ + { + "email": "aleldeib@microsoft.com", + "name": "Ace Eldeib", + "role": "author" + } + ], + "document_names": { + "description": "DESCRIPTION.rst" + }, + "project_urls": { + "Home": "https://github.com/Azure/azure-cli-extensions" + } + } + }, + "generator": "bdist_wheel (0.30.0)", + "license": "MIT", + "metadata_version": "2.0", + "name": "loganalytics", + "summary": "Support for Azure Log Analytics query functionality.", + "version": "1.0.0-Preview-1" + } + } ] } } diff --git a/src/loganalytics/HISTORY.rst b/src/loganalytics/HISTORY.rst index d3fe8370af0..620ef9c5800 100644 --- a/src/loganalytics/HISTORY.rst +++ b/src/loganalytics/HISTORY.rst @@ -1,4 +1,4 @@ -0.1.0 +1.0.0-Preview-1 ++++++++++++++++++ * Initial release. \ No newline at end of file diff --git a/src/loganalytics/README.rst b/src/loganalytics/README.rst index 76b7f17c8f7..49a13a938f6 100644 --- a/src/loganalytics/README.rst +++ b/src/loganalytics/README.rst @@ -1,2 +1,2 @@ -Azure Log Analytics CLI Extension -================================== +Commands for working with Azure Log Analytics +============================================== diff --git a/src/loganalytics/azext_loganalytics/_client_factory.py b/src/loganalytics/azext_loganalytics/_client_factory.py index ba8d64b1ec9..f4fe1e8d0a7 100644 --- a/src/loganalytics/azext_loganalytics/_client_factory.py +++ b/src/loganalytics/azext_loganalytics/_client_factory.py @@ -6,7 +6,7 @@ def loganalytics_data_plane_client(cli_ctx, _): """Initialize Log Analytics data client for use with CLI.""" - from .loganalytics import LogAnalyticsDataClient + from .vendored_sdks.loganalytics import LogAnalyticsDataClient from azure.cli.core._profile import Profile profile = Profile(cli_ctx=cli_ctx) cred, _, _ = profile.get_login_credentials( diff --git a/src/loganalytics/azext_loganalytics/custom.py b/src/loganalytics/azext_loganalytics/custom.py index 605180eb0d7..fac1e05952f 100644 --- a/src/loganalytics/azext_loganalytics/custom.py +++ b/src/loganalytics/azext_loganalytics/custom.py @@ -10,5 +10,5 @@ def execute_query(client, workspace, kql, timespan=None, workspaces=None): """Executes a query against the provided Log Analytics workspace.""" - from .loganalytics.models import QueryBody + from .vendored_sdks.loganalytics.models import QueryBody return client.query(workspace, QueryBody(query=kql, timespan=timespan, workspaces=workspaces)) diff --git a/src/loganalytics/azext_loganalytics/loganalytics/__init__.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/__init__.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/__init__.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/__init__.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/log_analytics_data_client.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/log_analytics_data_client.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/log_analytics_data_client.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/log_analytics_data_client.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/__init__.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/__init__.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/__init__.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/__init__.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/column.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/column.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/column_py3.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/column_py3.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column_py3.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/error_detail.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_detail_py3.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/error_detail_py3.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail_py3.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_info.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/error_info.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_info_py3.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/error_info_py3.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info_py3.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_response.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/error_response.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/error_response_py3.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/error_response_py3.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response_py3.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_body.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/query_body.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_body_py3.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/query_body_py3.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body_py3.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_results.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/query_results.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/query_results_py3.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/query_results_py3.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results_py3.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/table.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/table.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/models/table_py3.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/models/table_py3.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table_py3.py diff --git a/src/loganalytics/azext_loganalytics/loganalytics/version.py b/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/version.py similarity index 100% rename from src/loganalytics/azext_loganalytics/loganalytics/version.py rename to src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/version.py diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py index 55aa4cc6ab8..9555e6b971f 100644 --- a/src/loganalytics/setup.py +++ b/src/loganalytics/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.0.1" +VERSION = "1.0.0-Preview-1" CLASSIFIERS = [ 'Development Status :: 4 - Beta', @@ -32,7 +32,7 @@ HISTORY = f.read() setup( - name='loganalytics', + name='azure-loganalytics-cli-extension', version=VERSION, description='Support for Azure Log Analytics query capabilities.', long_description=README + '\n\n' + HISTORY, From 073f0fda3709a34b9848f1ccbe6a32d534135f50 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 26 Jul 2018 16:12:20 -0700 Subject: [PATCH 04/23] Fix CI, update version from regen with wheel==0.30.0 --- src/index.json | 6 +++--- src/loganalytics/HISTORY.rst | 5 +++++ src/loganalytics/azext_loganalytics/_help.py | 2 +- src/loganalytics/azext_loganalytics/commands.py | 2 +- src/loganalytics/setup.py | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/index.json b/src/index.json index 78e7acf6bed..668fbe98d3c 100644 --- a/src/index.json +++ b/src/index.json @@ -954,9 +954,9 @@ ], "loganalytics": [ { - "filename": "azure_loganalytics_cli_extension-1.0.0rc1-py2.py3-none-any.whl", - "sha256Digest": "5ad067ff88db9205c45f7498e2599d78906f20ff2364803aebc52a0a568a7018", - "downloadUrl": "https://files.pythonhosted.org/packages/60/c1/0dd5914b638d39ef0047ea1f5fb2a590d4e65b5822a23a2baac67441f226/azure_loganalytics_cli_extension-1.0.0rc1-py2.py3-none-any.whl", + "filename": "azure_loganalytics_cli_extension-1.0.0rc2-py2.py3-none-any.whl", + "sha256Digest": "38075c5df482053d5ca5a049b327616ba134c1e487fc79fb63904d8768ce9f63", + "downloadUrl": "https://files.pythonhosted.org/packages/4c/73/8a6a8327a2f64077bcfb905979ea2ebeb99e9d612602e01f5db9eb9f70ed/azure_loganalytics_cli_extension-1.0.0rc2-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, "classifiers": [ diff --git a/src/loganalytics/HISTORY.rst b/src/loganalytics/HISTORY.rst index 620ef9c5800..3e5da920290 100644 --- a/src/loganalytics/HISTORY.rst +++ b/src/loganalytics/HISTORY.rst @@ -1,3 +1,8 @@ +1.0.0-Preview-2 +++++++++++++++++++ + +* Regenerate using wheel==0.30.0 + 1.0.0-Preview-1 ++++++++++++++++++ diff --git a/src/loganalytics/azext_loganalytics/_help.py b/src/loganalytics/azext_loganalytics/_help.py index b07dfb3476f..28b96022130 100644 --- a/src/loganalytics/azext_loganalytics/_help.py +++ b/src/loganalytics/azext_loganalytics/_help.py @@ -19,7 +19,7 @@ short-summary: Query to execute over the Log Analytics data. - timespan: --timespan -t type: string - short-summary: Timespan over which to query data. Defaults to all data. + short-summary: Timespan over which to query data. Defaults to all data. - workspaces: --workspaces type: array short-summary: Additional workspaces to union data for querying. Specify additional workspace IDs separated by commas. diff --git a/src/loganalytics/azext_loganalytics/commands.py b/src/loganalytics/azext_loganalytics/commands.py index e00616a25a7..f961a7e1fc5 100644 --- a/src/loganalytics/azext_loganalytics/commands.py +++ b/src/loganalytics/azext_loganalytics/commands.py @@ -16,5 +16,5 @@ def load_command_table(self, _): client_factory=loganalytics_data_plane_client ) - with self.command_group('loganalytics', loganalytics_sdk) as g: + with self.command_group('monitor loganalytics', loganalytics_sdk) as g: g.command('query', 'execute_query') diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py index 9555e6b971f..469ad1e0065 100644 --- a/src/loganalytics/setup.py +++ b/src/loganalytics/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "1.0.0-Preview-1" +VERSION = "1.0.0-Preview-2" CLASSIFIERS = [ 'Development Status :: 4 - Beta', From c02dfcaf12859758164393d260e6058aa4950e6f Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 26 Jul 2018 16:32:33 -0700 Subject: [PATCH 05/23] add codeowner --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d13744434ac..f3b3dd8e612 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -34,4 +34,6 @@ /src/express-route-cross-connection/ @tjprescott +/src/loganalytics/ @alexeldeib + /src/mesh/ @linggengmsft From 8f40bb46f9e7328a9d5b2a1d78f0a54088d5c3df Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 26 Jul 2018 18:23:11 -0700 Subject: [PATCH 06/23] fix versions, ci, wheel issues --- src/index.json | 10 +++++----- src/loganalytics/HISTORY.rst | 7 +------ src/loganalytics/azext_loganalytics/_help.py | 2 +- src/loganalytics/azext_loganalytics/commands.py | 4 ++-- src/loganalytics/setup.py | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/index.json b/src/index.json index 668fbe98d3c..09e1d032a49 100644 --- a/src/index.json +++ b/src/index.json @@ -954,9 +954,9 @@ ], "loganalytics": [ { - "filename": "azure_loganalytics_cli_extension-1.0.0rc2-py2.py3-none-any.whl", - "sha256Digest": "38075c5df482053d5ca5a049b327616ba134c1e487fc79fb63904d8768ce9f63", - "downloadUrl": "https://files.pythonhosted.org/packages/4c/73/8a6a8327a2f64077bcfb905979ea2ebeb99e9d612602e01f5db9eb9f70ed/azure_loganalytics_cli_extension-1.0.0rc2-py2.py3-none-any.whl", + "filename": "azure_loganalytics_cli_extension-0.0.1-py2.py3-none-any.whl", + "sha256Digest": "f580c57dcde9e4665138c85019650488536cf63538ab7960e0cc9060890dba48", + "downloadUrl": "https://files.pythonhosted.org/packages/73/67/5136bd75abe3dc2f99d0969590eec4eec8890f0a31c9e137d5f72ad8de86/azure_loganalytics_cli_extension-0.0.1-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, "classifiers": [ @@ -985,7 +985,7 @@ "description": "DESCRIPTION.rst" }, "project_urls": { - "Home": "https://github.com/Azure/azure-cli-extensions" + "Home": "https://github.com/Azure/azure-cli-extensions/tree/master/src/log-analytics" } } }, @@ -994,7 +994,7 @@ "metadata_version": "2.0", "name": "loganalytics", "summary": "Support for Azure Log Analytics query functionality.", - "version": "1.0.0-Preview-1" + "version": "0.0.1" } } ] diff --git a/src/loganalytics/HISTORY.rst b/src/loganalytics/HISTORY.rst index 3e5da920290..40e9e832070 100644 --- a/src/loganalytics/HISTORY.rst +++ b/src/loganalytics/HISTORY.rst @@ -1,9 +1,4 @@ -1.0.0-Preview-2 -++++++++++++++++++ - -* Regenerate using wheel==0.30.0 - -1.0.0-Preview-1 +0.0.1 ++++++++++++++++++ * Initial release. \ No newline at end of file diff --git a/src/loganalytics/azext_loganalytics/_help.py b/src/loganalytics/azext_loganalytics/_help.py index 28b96022130..dff5136ec12 100644 --- a/src/loganalytics/azext_loganalytics/_help.py +++ b/src/loganalytics/azext_loganalytics/_help.py @@ -7,7 +7,7 @@ # pylint: disable=line-too-long -helps['loganalytics query'] = """ +helps['monitor loganalytics query'] = """ type: command short-summary: Query a Log Analytics workspace. parameters: diff --git a/src/loganalytics/azext_loganalytics/commands.py b/src/loganalytics/azext_loganalytics/commands.py index f961a7e1fc5..0405cd758b9 100644 --- a/src/loganalytics/azext_loganalytics/commands.py +++ b/src/loganalytics/azext_loganalytics/commands.py @@ -16,5 +16,5 @@ def load_command_table(self, _): client_factory=loganalytics_data_plane_client ) - with self.command_group('monitor loganalytics', loganalytics_sdk) as g: - g.command('query', 'execute_query') + with self.command_group('monitor log-analytics') as g: + g.custom_command('query', 'execute_query') diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py index 469ad1e0065..eac117700a1 100644 --- a/src/loganalytics/setup.py +++ b/src/loganalytics/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "1.0.0-Preview-2" +VERSION = "0.0.1" CLASSIFIERS = [ 'Development Status :: 4 - Beta', From 46eea300abe47e3a6e8cff1886ec64367d5e662e Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 26 Jul 2018 18:24:00 -0700 Subject: [PATCH 07/23] rename loganalytics -> log-analytics --- src/index.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.json b/src/index.json index 09e1d032a49..dcaf755bd87 100644 --- a/src/index.json +++ b/src/index.json @@ -952,7 +952,7 @@ } } ], - "loganalytics": [ + "log-analytics": [ { "filename": "azure_loganalytics_cli_extension-0.0.1-py2.py3-none-any.whl", "sha256Digest": "f580c57dcde9e4665138c85019650488536cf63538ab7960e0cc9060890dba48", @@ -992,7 +992,7 @@ "generator": "bdist_wheel (0.30.0)", "license": "MIT", "metadata_version": "2.0", - "name": "loganalytics", + "name": "log-analytics", "summary": "Support for Azure Log Analytics query functionality.", "version": "0.0.1" } From 9417f433c2cb7c07d8bf5fcfbe6fd78d7c595282 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 26 Jul 2018 18:29:22 -0700 Subject: [PATCH 08/23] switch command -> custom command --- src/loganalytics/azext_loganalytics/commands.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/loganalytics/azext_loganalytics/commands.py b/src/loganalytics/azext_loganalytics/commands.py index 0405cd758b9..725a8b84775 100644 --- a/src/loganalytics/azext_loganalytics/commands.py +++ b/src/loganalytics/azext_loganalytics/commands.py @@ -11,10 +11,5 @@ def load_command_table(self, _): from azure.cli.core.commands import CliCommandType from azext_loganalytics._client_factory import loganalytics_data_plane_client - loganalytics_sdk = CliCommandType( - operations_tmpl='azext_loganalytics.custom#{}', - client_factory=loganalytics_data_plane_client - ) - with self.command_group('monitor log-analytics') as g: g.custom_command('query', 'execute_query') From 6844dd0fe88fcb0a2964f80515438f58890f9d5e Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Thu, 26 Jul 2018 18:41:22 -0700 Subject: [PATCH 09/23] unused imports --- src/loganalytics/azext_loganalytics/commands.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/loganalytics/azext_loganalytics/commands.py b/src/loganalytics/azext_loganalytics/commands.py index 725a8b84775..db0eed247ab 100644 --- a/src/loganalytics/azext_loganalytics/commands.py +++ b/src/loganalytics/azext_loganalytics/commands.py @@ -8,8 +8,5 @@ def load_command_table(self, _): - from azure.cli.core.commands import CliCommandType - from azext_loganalytics._client_factory import loganalytics_data_plane_client - with self.command_group('monitor log-analytics') as g: g.custom_command('query', 'execute_query') From edcb154d040fbd2d49fa2f185169edf07e623b5b Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 11:42:01 -0700 Subject: [PATCH 10/23] fix after python environment mess --- src/index.json | 8 ++++---- src/loganalytics/HISTORY.rst | 4 ++++ src/loganalytics/setup.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/index.json b/src/index.json index dcaf755bd87..ad7e8678a41 100644 --- a/src/index.json +++ b/src/index.json @@ -954,9 +954,9 @@ ], "log-analytics": [ { - "filename": "azure_loganalytics_cli_extension-0.0.1-py2.py3-none-any.whl", - "sha256Digest": "f580c57dcde9e4665138c85019650488536cf63538ab7960e0cc9060890dba48", - "downloadUrl": "https://files.pythonhosted.org/packages/73/67/5136bd75abe3dc2f99d0969590eec4eec8890f0a31c9e137d5f72ad8de86/azure_loganalytics_cli_extension-0.0.1-py2.py3-none-any.whl", + "filename": "azure_loganalytics_cli_extension-0.0.2-py2.py3-none-any.whl", + "sha256Digest": "e4c10255a55339e232e1b4cca21e711dff1b96c97ca31e824b14b7dbe613e1df", + "downloadUrl": "https://files.pythonhosted.org/packages/d5/ef/9c1d124d69e0281b420c1f66dad1691c3d62666fa534bfccb1ee330f03fc/azure_loganalytics_cli_extension-0.0.2-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, "classifiers": [ @@ -994,7 +994,7 @@ "metadata_version": "2.0", "name": "log-analytics", "summary": "Support for Azure Log Analytics query functionality.", - "version": "0.0.1" + "version": "0.0.2" } } ] diff --git a/src/loganalytics/HISTORY.rst b/src/loganalytics/HISTORY.rst index 40e9e832070..1268f312a98 100644 --- a/src/loganalytics/HISTORY.rst +++ b/src/loganalytics/HISTORY.rst @@ -1,3 +1,7 @@ +0.0.2 +++++++++++++++++++ +* Use wheel==0.30.0 to add missing metadata.json file. + 0.0.1 ++++++++++++++++++ diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py index eac117700a1..d9ace163c6e 100644 --- a/src/loganalytics/setup.py +++ b/src/loganalytics/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.0.1" +VERSION = "0.0.2" CLASSIFIERS = [ 'Development Status :: 4 - Beta', From 7fa4cbe00efa7eeab026c023ed211d0d7fcfb566 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 13:37:53 -0700 Subject: [PATCH 11/23] naming --- src/index.json | 9 ++++----- src/loganalytics/HISTORY.rst | 6 +----- src/loganalytics/setup.py | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/index.json b/src/index.json index ad7e8678a41..f01d987eeb7 100644 --- a/src/index.json +++ b/src/index.json @@ -954,11 +954,10 @@ ], "log-analytics": [ { - "filename": "azure_loganalytics_cli_extension-0.0.2-py2.py3-none-any.whl", - "sha256Digest": "e4c10255a55339e232e1b4cca21e711dff1b96c97ca31e824b14b7dbe613e1df", - "downloadUrl": "https://files.pythonhosted.org/packages/d5/ef/9c1d124d69e0281b420c1f66dad1691c3d62666fa534bfccb1ee330f03fc/azure_loganalytics_cli_extension-0.0.2-py2.py3-none-any.whl", + "filename": "log_analytics-0.1.0-py2.py3-none-any.whl", + "sha256Digest": "ec1ca986a89b888a89212983d86b601f4dda8f44d692f9e274a8d9990d8fd69c", + "downloadUrl": "https://files.pythonhosted.org/packages/ab/e0/1544579808c8de57ca2a39cf27e1be4f9f777238386c14801753155f3dc6/log_analytics-0.1.0-py2.py3-none-any.whl", "metadata": { - "azext.isPreview": true, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", @@ -994,7 +993,7 @@ "metadata_version": "2.0", "name": "log-analytics", "summary": "Support for Azure Log Analytics query functionality.", - "version": "0.0.2" + "version": "0.1.0" } } ] diff --git a/src/loganalytics/HISTORY.rst b/src/loganalytics/HISTORY.rst index 1268f312a98..d3fe8370af0 100644 --- a/src/loganalytics/HISTORY.rst +++ b/src/loganalytics/HISTORY.rst @@ -1,8 +1,4 @@ -0.0.2 -++++++++++++++++++ -* Use wheel==0.30.0 to add missing metadata.json file. - -0.0.1 +0.1.0 ++++++++++++++++++ * Initial release. \ No newline at end of file diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py index d9ace163c6e..02c9833c699 100644 --- a/src/loganalytics/setup.py +++ b/src/loganalytics/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.0.2" +VERSION = "0.1.0" CLASSIFIERS = [ 'Development Status :: 4 - Beta', @@ -32,7 +32,7 @@ HISTORY = f.read() setup( - name='azure-loganalytics-cli-extension', + name='log-analytics', version=VERSION, description='Support for Azure Log Analytics query capabilities.', long_description=README + '\n\n' + HISTORY, From 7a1454a4ea2b881aa0d6b50bced4fe77ae27049a Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 13:52:40 -0700 Subject: [PATCH 12/23] fix homepage and bump minor version --- src/index.json | 24 ++++++------------------ src/loganalytics/HISTORY.rst | 5 +++++ src/loganalytics/setup.py | 4 ++-- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/index.json b/src/index.json index f01d987eeb7..1fa8c1c1443 100644 --- a/src/index.json +++ b/src/index.json @@ -954,23 +954,11 @@ ], "log-analytics": [ { - "filename": "log_analytics-0.1.0-py2.py3-none-any.whl", - "sha256Digest": "ec1ca986a89b888a89212983d86b601f4dda8f44d692f9e274a8d9990d8fd69c", - "downloadUrl": "https://files.pythonhosted.org/packages/ab/e0/1544579808c8de57ca2a39cf27e1be4f9f777238386c14801753155f3dc6/log_analytics-0.1.0-py2.py3-none-any.whl", + "filename": "log_analytics-0.1.1-py2.py3-none-any.whl", + "sha256Digest": "98b88daa6eb978354bbcdc177fba48921186193da0b3f2906fb61845024f352b", + "downloadUrl": "https://files.pythonhosted.org/packages/87/ff/6aff19ead74388299b176b907ec2f0abbd39dbfedf46349ab37476b5f57b/log_analytics-0.1.1-py2.py3-none-any.whl", "metadata": { - "classifiers": [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: System Administrators", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "License :: OSI Approved :: MIT License" - ], + "azext.isPreview": true, "extensions": { "python.details": { "contacts": [ @@ -992,8 +980,8 @@ "license": "MIT", "metadata_version": "2.0", "name": "log-analytics", - "summary": "Support for Azure Log Analytics query functionality.", - "version": "0.1.0" + "summary": "Support for Azure Log Analytics query capabilities.", + "version": "0.1.1" } } ] diff --git a/src/loganalytics/HISTORY.rst b/src/loganalytics/HISTORY.rst index d3fe8370af0..fb96c1b9fda 100644 --- a/src/loganalytics/HISTORY.rst +++ b/src/loganalytics/HISTORY.rst @@ -1,3 +1,8 @@ +0.1.1 +++++++++++++++++++ + +* Fix homepage + 0.1.0 ++++++++++++++++++ diff --git a/src/loganalytics/setup.py b/src/loganalytics/setup.py index 02c9833c699..7f371c930ad 100644 --- a/src/loganalytics/setup.py +++ b/src/loganalytics/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.1.0" +VERSION = "0.1.1" CLASSIFIERS = [ 'Development Status :: 4 - Beta', @@ -39,7 +39,7 @@ license='MIT', author='Ace Eldeib', author_email='aleldeib@microsoft.com', - url='https://github.com/Azure/azure-cli-extensions', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/log-analytics', classifiers=CLASSIFIERS, packages=find_packages(exclude=["tests"]), package_data={'azext_loganalytics': ['azext_metadata.json']}, From 531d1d4f4979c998d1a1498a877769ad15efde80 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 14:08:21 -0700 Subject: [PATCH 13/23] fix src tests --- src/loganalytics/azext_loganalytics/_params.py | 2 +- .../tests/latest/recordings/test_query.yaml | 15 ++++++++------- .../tests/latest/test_loganalytics_commands.py | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/loganalytics/azext_loganalytics/_params.py b/src/loganalytics/azext_loganalytics/_params.py index 307406c869d..1e096ba4157 100644 --- a/src/loganalytics/azext_loganalytics/_params.py +++ b/src/loganalytics/azext_loganalytics/_params.py @@ -7,7 +7,7 @@ def load_arguments(self, _): - with self.argument_context('loganalytics') as c: + with self.argument_context('monitor log-analytics') as c: c.argument('workspace', options_list=['--workspace', '-w'], help='GUID of the Log Analytics Workspace', required=True) c.argument('kql', help='Query to execute over Log Analytics data.', required=True) c.argument('timespan', options_list=['--timespan', '-t'], help='Timespan over which to query. Defaults to querying all available data.') diff --git a/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml b/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml index 79cf787ae4b..3d6177b52ed 100644 --- a/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml +++ b/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml @@ -7,7 +7,7 @@ interactions: Connection: [keep-alive] Content-Length: ['34'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.4 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.3 + User-Agent: [python/3.6.6 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 azure-loganalytics/0.1.0] method: POST uri: https://api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query @@ -16,17 +16,18 @@ interactions: headers: access-control-allow-origin: ['*'] access-control-expose-headers: ['Retry-After,Age,WWW-Authenticate,x-resource-identities,x-ms-status-location'] + age: ['68'] connection: [keep-alive] content-length: ['1482'] content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] content-type: [application/json; charset=utf-8] - date: ['Mon, 16 Jul 2018 18:19:50 GMT'] + date: ['Fri, 27 Jul 2018 21:07:59 GMT'] server: [nginx] strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - via: [1.1 draft-oms-green.9ae239f1-88dc-11e8-aedf-70b3d5800006] + via: [1.1 draft-oms-blue.c19c0844-91d5-11e8-b1c7-4a76e6685f8c] x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: @@ -37,7 +38,7 @@ interactions: Connection: [keep-alive] Content-Length: ['34'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.4 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.3 + User-Agent: [python/3.6.6 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 azure-loganalytics/0.1.0] method: POST uri: https://api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query @@ -46,18 +47,18 @@ interactions: headers: access-control-allow-origin: ['*'] access-control-expose-headers: ['Retry-After,Age,WWW-Authenticate,x-resource-identities,x-ms-status-location'] - age: ['0'] + age: ['69'] connection: [keep-alive] content-length: ['1482'] content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] content-type: [application/json; charset=utf-8] - date: ['Mon, 16 Jul 2018 18:19:50 GMT'] + date: ['Fri, 27 Jul 2018 21:07:59 GMT'] server: [nginx] strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - via: [1.1 draft-oms-green.c01b97e7-888d-11e8-aedf-70b3d5800006] + via: [1.1 draft-oms-blue.073b928b-91db-11e8-b1c7-4a76e6685f8c] x-content-type-options: [nosniff] status: {code: 200, message: OK} version: 1 diff --git a/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py b/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py index f91e172a652..e254fc2eed6 100644 --- a/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py +++ b/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py @@ -11,9 +11,9 @@ class LogAnalyticsDataClientTests(ScenarioTest): """Test class for Log Analytics data client.""" def test_query(self): """Tests data plane query capabilities for Log Analytics.""" - self.cmd('az loganalytics query -w cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"', checks=[ + self.cmd('az monitor log-analytics query --workspace cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"', checks=[ self.check('tables[0].rows[0][0]', 'TenantId') ]) - query_result = self.cmd('az loganalytics query -w cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"').get_output_in_json() + query_result = self.cmd('az monitor log-analytics query -w cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"').get_output_in_json() assert len(query_result['tables'][0]['rows']) == 29 assert isinstance(query_result['tables'][0]['rows'][0][1], (int, float, complex)) From 37d157412d2f1af30688158097c9435523ce4796 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 14:11:18 -0700 Subject: [PATCH 14/23] loganalytics -> log-analytics --- src/loganalytics/azext_loganalytics/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loganalytics/azext_loganalytics/_help.py b/src/loganalytics/azext_loganalytics/_help.py index dff5136ec12..f5cb3753e58 100644 --- a/src/loganalytics/azext_loganalytics/_help.py +++ b/src/loganalytics/azext_loganalytics/_help.py @@ -7,7 +7,7 @@ # pylint: disable=line-too-long -helps['monitor loganalytics query'] = """ +helps['monitor log-analytics query'] = """ type: command short-summary: Query a Log Analytics workspace. parameters: From 5c9dbdc576682bce93dc5691bbb7aff4f76d04a1 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 14:12:33 -0700 Subject: [PATCH 15/23] rename directory --- src/log-analytics/.pytest_cache/v/cache/lastfailed | 1 + src/log-analytics/.pytest_cache/v/cache/nodeids | 3 +++ src/{loganalytics => log-analytics}/HISTORY.rst | 0 src/{loganalytics => log-analytics}/README.rst | 0 .../azext_loganalytics/__init__.py | 0 .../azext_loganalytics/_client_factory.py | 0 .../azext_loganalytics/_help.py | 0 .../azext_loganalytics/_params.py | 0 .../azext_loganalytics/azext_metadata.json | 0 .../azext_loganalytics/commands.py | 0 .../azext_loganalytics/custom.py | 0 .../azext_loganalytics/tests/__init__.py | 0 .../azext_loganalytics/tests/latest/__init__.py | 0 .../azext_loganalytics/tests/latest/recordings/test_query.yaml | 0 .../tests/latest/test_loganalytics_commands.py | 0 .../azext_loganalytics/vendored_sdks/loganalytics/__init__.py | 0 .../vendored_sdks/loganalytics/log_analytics_data_client.py | 0 .../vendored_sdks/loganalytics/models/__init__.py | 0 .../vendored_sdks/loganalytics/models/column.py | 0 .../vendored_sdks/loganalytics/models/column_py3.py | 0 .../vendored_sdks/loganalytics/models/error_detail.py | 0 .../vendored_sdks/loganalytics/models/error_detail_py3.py | 0 .../vendored_sdks/loganalytics/models/error_info.py | 0 .../vendored_sdks/loganalytics/models/error_info_py3.py | 0 .../vendored_sdks/loganalytics/models/error_response.py | 0 .../vendored_sdks/loganalytics/models/error_response_py3.py | 0 .../vendored_sdks/loganalytics/models/query_body.py | 0 .../vendored_sdks/loganalytics/models/query_body_py3.py | 0 .../vendored_sdks/loganalytics/models/query_results.py | 0 .../vendored_sdks/loganalytics/models/query_results_py3.py | 0 .../vendored_sdks/loganalytics/models/table.py | 0 .../vendored_sdks/loganalytics/models/table_py3.py | 0 .../azext_loganalytics/vendored_sdks/loganalytics/version.py | 0 src/{loganalytics => log-analytics}/setup.cfg | 0 src/{loganalytics => log-analytics}/setup.py | 0 35 files changed, 4 insertions(+) create mode 100644 src/log-analytics/.pytest_cache/v/cache/lastfailed create mode 100644 src/log-analytics/.pytest_cache/v/cache/nodeids rename src/{loganalytics => log-analytics}/HISTORY.rst (100%) rename src/{loganalytics => log-analytics}/README.rst (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/__init__.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/_client_factory.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/_help.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/_params.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/azext_metadata.json (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/commands.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/custom.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/tests/__init__.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/tests/latest/__init__.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/tests/latest/recordings/test_query.yaml (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/tests/latest/test_loganalytics_commands.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/__init__.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/log_analytics_data_client.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/__init__.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/column.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/column_py3.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail_py3.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/error_info.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/error_info_py3.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/error_response.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/error_response_py3.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/query_body.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/query_body_py3.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/query_results.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/query_results_py3.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/table.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/models/table_py3.py (100%) rename src/{loganalytics => log-analytics}/azext_loganalytics/vendored_sdks/loganalytics/version.py (100%) rename src/{loganalytics => log-analytics}/setup.cfg (100%) rename src/{loganalytics => log-analytics}/setup.py (100%) diff --git a/src/log-analytics/.pytest_cache/v/cache/lastfailed b/src/log-analytics/.pytest_cache/v/cache/lastfailed new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/src/log-analytics/.pytest_cache/v/cache/lastfailed @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/log-analytics/.pytest_cache/v/cache/nodeids b/src/log-analytics/.pytest_cache/v/cache/nodeids new file mode 100644 index 00000000000..c4538da606c --- /dev/null +++ b/src/log-analytics/.pytest_cache/v/cache/nodeids @@ -0,0 +1,3 @@ +[ + "azext_loganalytics/tests/latest/test_loganalytics_commands.py::LogAnalyticsDataClientTests::test_query" +] \ No newline at end of file diff --git a/src/loganalytics/HISTORY.rst b/src/log-analytics/HISTORY.rst similarity index 100% rename from src/loganalytics/HISTORY.rst rename to src/log-analytics/HISTORY.rst diff --git a/src/loganalytics/README.rst b/src/log-analytics/README.rst similarity index 100% rename from src/loganalytics/README.rst rename to src/log-analytics/README.rst diff --git a/src/loganalytics/azext_loganalytics/__init__.py b/src/log-analytics/azext_loganalytics/__init__.py similarity index 100% rename from src/loganalytics/azext_loganalytics/__init__.py rename to src/log-analytics/azext_loganalytics/__init__.py diff --git a/src/loganalytics/azext_loganalytics/_client_factory.py b/src/log-analytics/azext_loganalytics/_client_factory.py similarity index 100% rename from src/loganalytics/azext_loganalytics/_client_factory.py rename to src/log-analytics/azext_loganalytics/_client_factory.py diff --git a/src/loganalytics/azext_loganalytics/_help.py b/src/log-analytics/azext_loganalytics/_help.py similarity index 100% rename from src/loganalytics/azext_loganalytics/_help.py rename to src/log-analytics/azext_loganalytics/_help.py diff --git a/src/loganalytics/azext_loganalytics/_params.py b/src/log-analytics/azext_loganalytics/_params.py similarity index 100% rename from src/loganalytics/azext_loganalytics/_params.py rename to src/log-analytics/azext_loganalytics/_params.py diff --git a/src/loganalytics/azext_loganalytics/azext_metadata.json b/src/log-analytics/azext_loganalytics/azext_metadata.json similarity index 100% rename from src/loganalytics/azext_loganalytics/azext_metadata.json rename to src/log-analytics/azext_loganalytics/azext_metadata.json diff --git a/src/loganalytics/azext_loganalytics/commands.py b/src/log-analytics/azext_loganalytics/commands.py similarity index 100% rename from src/loganalytics/azext_loganalytics/commands.py rename to src/log-analytics/azext_loganalytics/commands.py diff --git a/src/loganalytics/azext_loganalytics/custom.py b/src/log-analytics/azext_loganalytics/custom.py similarity index 100% rename from src/loganalytics/azext_loganalytics/custom.py rename to src/log-analytics/azext_loganalytics/custom.py diff --git a/src/loganalytics/azext_loganalytics/tests/__init__.py b/src/log-analytics/azext_loganalytics/tests/__init__.py similarity index 100% rename from src/loganalytics/azext_loganalytics/tests/__init__.py rename to src/log-analytics/azext_loganalytics/tests/__init__.py diff --git a/src/loganalytics/azext_loganalytics/tests/latest/__init__.py b/src/log-analytics/azext_loganalytics/tests/latest/__init__.py similarity index 100% rename from src/loganalytics/azext_loganalytics/tests/latest/__init__.py rename to src/log-analytics/azext_loganalytics/tests/latest/__init__.py diff --git a/src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml b/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml similarity index 100% rename from src/loganalytics/azext_loganalytics/tests/latest/recordings/test_query.yaml rename to src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml diff --git a/src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py b/src/log-analytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py similarity index 100% rename from src/loganalytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py rename to src/log-analytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/__init__.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/__init__.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/__init__.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/__init__.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/log_analytics_data_client.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/log_analytics_data_client.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/log_analytics_data_client.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/log_analytics_data_client.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/__init__.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/__init__.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/__init__.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/__init__.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/column.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/column.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column_py3.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/column_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/column_py3.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/column_py3.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail_py3.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail_py3.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_detail_py3.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info_py3.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info_py3.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_info_py3.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response_py3.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response_py3.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/error_response_py3.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body_py3.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body_py3.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_body_py3.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results_py3.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results_py3.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/query_results_py3.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/table.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/table.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table_py3.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/table_py3.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/models/table_py3.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/models/table_py3.py diff --git a/src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/version.py b/src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/version.py similarity index 100% rename from src/loganalytics/azext_loganalytics/vendored_sdks/loganalytics/version.py rename to src/log-analytics/azext_loganalytics/vendored_sdks/loganalytics/version.py diff --git a/src/loganalytics/setup.cfg b/src/log-analytics/setup.cfg similarity index 100% rename from src/loganalytics/setup.cfg rename to src/log-analytics/setup.cfg diff --git a/src/loganalytics/setup.py b/src/log-analytics/setup.py similarity index 100% rename from src/loganalytics/setup.py rename to src/log-analytics/setup.py From 6d0288fe3f5cdefa7d0f4aa255c78ad12342ed89 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 14:24:56 -0700 Subject: [PATCH 16/23] params --- src/log-analytics/azext_loganalytics/_params.py | 6 +++--- src/log-analytics/setup.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/log-analytics/azext_loganalytics/_params.py b/src/log-analytics/azext_loganalytics/_params.py index 1e096ba4157..623064a81dc 100644 --- a/src/log-analytics/azext_loganalytics/_params.py +++ b/src/log-analytics/azext_loganalytics/_params.py @@ -7,8 +7,8 @@ def load_arguments(self, _): - with self.argument_context('monitor log-analytics') as c: - c.argument('workspace', options_list=['--workspace', '-w'], help='GUID of the Log Analytics Workspace', required=True) - c.argument('kql', help='Query to execute over Log Analytics data.', required=True) + with self.argument_context('monitor log-analytics query') as c: + c.argument('workspace', options_list=['--workspace', '-w'], help='GUID of the Log Analytics Workspace') + c.argument('kql', help='Query to execute over Log Analytics data.') c.argument('timespan', options_list=['--timespan', '-t'], help='Timespan over which to query. Defaults to querying all available data.') c.argument('workspaces', nargs='+', help='Optional additional workspaces over which to join data for the query.') diff --git a/src/log-analytics/setup.py b/src/log-analytics/setup.py index 7f371c930ad..de6a9ea17fb 100644 --- a/src/log-analytics/setup.py +++ b/src/log-analytics/setup.py @@ -39,7 +39,7 @@ license='MIT', author='Ace Eldeib', author_email='aleldeib@microsoft.com', - url='https://github.com/Azure/azure-cli-extensions/tree/master/src/log-analytics', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/log', classifiers=CLASSIFIERS, packages=find_packages(exclude=["tests"]), package_data={'azext_loganalytics': ['azext_metadata.json']}, From 5b826d720283fcfc5ba107da5d160555e6c2d34d Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 14:28:29 -0700 Subject: [PATCH 17/23] accidental deletion --- src/log-analytics/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/log-analytics/setup.py b/src/log-analytics/setup.py index de6a9ea17fb..7f371c930ad 100644 --- a/src/log-analytics/setup.py +++ b/src/log-analytics/setup.py @@ -39,7 +39,7 @@ license='MIT', author='Ace Eldeib', author_email='aleldeib@microsoft.com', - url='https://github.com/Azure/azure-cli-extensions/tree/master/src/log', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/log-analytics', classifiers=CLASSIFIERS, packages=find_packages(exclude=["tests"]), package_data={'azext_loganalytics': ['azext_metadata.json']}, From ba14a673a40a27737fa491b58b30a4394e535d0f Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 14:28:47 -0700 Subject: [PATCH 18/23] codeowners --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f3b3dd8e612..01fc0712b50 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -34,6 +34,6 @@ /src/express-route-cross-connection/ @tjprescott -/src/loganalytics/ @alexeldeib +/src/log-analytics/ @alexeldeib /src/mesh/ @linggengmsft From 87db7df08b36cc13c71ae35549ea925ea0bc81c7 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 14:41:04 -0700 Subject: [PATCH 19/23] fix CI test namespacing issue(?) --- .../tests/latest/recordings/test_query.yaml | 11 +++++------ .../azext_loganalytics/vendored_sdks/__init__.py | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/log-analytics/azext_loganalytics/vendored_sdks/__init__.py diff --git a/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml b/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml index 3d6177b52ed..a1841f67308 100644 --- a/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml +++ b/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml @@ -16,18 +16,17 @@ interactions: headers: access-control-allow-origin: ['*'] access-control-expose-headers: ['Retry-After,Age,WWW-Authenticate,x-resource-identities,x-ms-status-location'] - age: ['68'] connection: [keep-alive] content-length: ['1482'] content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] content-type: [application/json; charset=utf-8] - date: ['Fri, 27 Jul 2018 21:07:59 GMT'] + date: ['Fri, 27 Jul 2018 21:37:12 GMT'] server: [nginx] strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - via: [1.1 draft-oms-blue.c19c0844-91d5-11e8-b1c7-4a76e6685f8c] + via: [1.1 draft-oms-blue.91272c6c-91e2-11e8-b1c7-4a76e6685f8c] x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: @@ -47,18 +46,18 @@ interactions: headers: access-control-allow-origin: ['*'] access-control-expose-headers: ['Retry-After,Age,WWW-Authenticate,x-resource-identities,x-ms-status-location'] - age: ['69'] + age: ['0'] connection: [keep-alive] content-length: ['1482'] content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] content-type: [application/json; charset=utf-8] - date: ['Fri, 27 Jul 2018 21:07:59 GMT'] + date: ['Fri, 27 Jul 2018 21:37:12 GMT'] server: [nginx] strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - via: [1.1 draft-oms-blue.073b928b-91db-11e8-b1c7-4a76e6685f8c] + via: [1.1 draft-oms-blue.4f639d62-91d5-11e8-b1c7-4a76e6685f8c] x-content-type-options: [nosniff] status: {code: 200, message: OK} version: 1 diff --git a/src/log-analytics/azext_loganalytics/vendored_sdks/__init__.py b/src/log-analytics/azext_loganalytics/vendored_sdks/__init__.py new file mode 100644 index 00000000000..a5b81f3bde4 --- /dev/null +++ b/src/log-analytics/azext_loganalytics/vendored_sdks/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +__import__('pkg_resources').declare_namespace(__name__) From fd5356b695ac6b4e0fe1f3cf3594d5472f71e91d Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 15:53:11 -0700 Subject: [PATCH 20/23] Delete lastfailed --- src/log-analytics/.pytest_cache/v/cache/lastfailed | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/log-analytics/.pytest_cache/v/cache/lastfailed diff --git a/src/log-analytics/.pytest_cache/v/cache/lastfailed b/src/log-analytics/.pytest_cache/v/cache/lastfailed deleted file mode 100644 index 9e26dfeeb6e..00000000000 --- a/src/log-analytics/.pytest_cache/v/cache/lastfailed +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file From 345c3dbf0d685484f1bce52ac97db5c4f5558d8d Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 15:53:18 -0700 Subject: [PATCH 21/23] Delete nodeids --- src/log-analytics/.pytest_cache/v/cache/nodeids | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/log-analytics/.pytest_cache/v/cache/nodeids diff --git a/src/log-analytics/.pytest_cache/v/cache/nodeids b/src/log-analytics/.pytest_cache/v/cache/nodeids deleted file mode 100644 index c4538da606c..00000000000 --- a/src/log-analytics/.pytest_cache/v/cache/nodeids +++ /dev/null @@ -1,3 +0,0 @@ -[ - "azext_loganalytics/tests/latest/test_loganalytics_commands.py::LogAnalyticsDataClientTests::test_query" -] \ No newline at end of file From 53fddc91067f20979664a0975627eeedc747d617 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 16:08:24 -0700 Subject: [PATCH 22/23] update parameter name --- src/log-analytics/azext_loganalytics/_help.py | 2 +- src/log-analytics/azext_loganalytics/_params.py | 2 +- src/log-analytics/azext_loganalytics/custom.py | 4 ++-- .../tests/latest/recordings/test_query.yaml | 8 ++++---- .../tests/latest/test_loganalytics_commands.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/log-analytics/azext_loganalytics/_help.py b/src/log-analytics/azext_loganalytics/_help.py index f5cb3753e58..059a19d5b9b 100644 --- a/src/log-analytics/azext_loganalytics/_help.py +++ b/src/log-analytics/azext_loganalytics/_help.py @@ -14,7 +14,7 @@ - workspace: --workspace -w type: string short-summary: GUID of the Log Analytics workspace. - - kql: --kql -k + - analytics-query: --analytics-query type: string short-summary: Query to execute over the Log Analytics data. - timespan: --timespan -t diff --git a/src/log-analytics/azext_loganalytics/_params.py b/src/log-analytics/azext_loganalytics/_params.py index 623064a81dc..9cdce306487 100644 --- a/src/log-analytics/azext_loganalytics/_params.py +++ b/src/log-analytics/azext_loganalytics/_params.py @@ -9,6 +9,6 @@ def load_arguments(self, _): with self.argument_context('monitor log-analytics query') as c: c.argument('workspace', options_list=['--workspace', '-w'], help='GUID of the Log Analytics Workspace') - c.argument('kql', help='Query to execute over Log Analytics data.') + c.argument('analytics-query', help='Query to execute over Log Analytics data.') c.argument('timespan', options_list=['--timespan', '-t'], help='Timespan over which to query. Defaults to querying all available data.') c.argument('workspaces', nargs='+', help='Optional additional workspaces over which to join data for the query.') diff --git a/src/log-analytics/azext_loganalytics/custom.py b/src/log-analytics/azext_loganalytics/custom.py index fac1e05952f..74cf8884198 100644 --- a/src/log-analytics/azext_loganalytics/custom.py +++ b/src/log-analytics/azext_loganalytics/custom.py @@ -8,7 +8,7 @@ logger = get_logger(__name__) -def execute_query(client, workspace, kql, timespan=None, workspaces=None): +def execute_query(client, workspace, analytics_query, timespan=None, workspaces=None): """Executes a query against the provided Log Analytics workspace.""" from .vendored_sdks.loganalytics.models import QueryBody - return client.query(workspace, QueryBody(query=kql, timespan=timespan, workspaces=workspaces)) + return client.query(workspace, QueryBody(query=analytics_query, timespan=timespan, workspaces=workspaces)) diff --git a/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml b/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml index a1841f67308..e0654423dba 100644 --- a/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml +++ b/src/log-analytics/azext_loganalytics/tests/latest/recordings/test_query.yaml @@ -20,13 +20,13 @@ interactions: content-length: ['1482'] content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] content-type: [application/json; charset=utf-8] - date: ['Fri, 27 Jul 2018 21:37:12 GMT'] + date: ['Fri, 27 Jul 2018 23:07:57 GMT'] server: [nginx] strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - via: [1.1 draft-oms-blue.91272c6c-91e2-11e8-b1c7-4a76e6685f8c] + via: [1.1 draft-oms-blue.aa4dbcee-9107-11e8-9ab8-70b3d5800008] x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: @@ -51,13 +51,13 @@ interactions: content-length: ['1482'] content-location: ['https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query'] content-type: [application/json; charset=utf-8] - date: ['Fri, 27 Jul 2018 21:37:12 GMT'] + date: ['Fri, 27 Jul 2018 23:07:58 GMT'] server: [nginx] strict-transport-security: [max-age=31536000000; includeSubDomains, max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: [Accept-Encoding] - via: [1.1 draft-oms-blue.4f639d62-91d5-11e8-b1c7-4a76e6685f8c] + via: [1.1 draft-oms-blue.cbd591df-9107-11e8-9ab8-70b3d5800008] x-content-type-options: [nosniff] status: {code: 200, message: OK} version: 1 diff --git a/src/log-analytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py b/src/log-analytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py index e254fc2eed6..b35aeb96fd8 100644 --- a/src/log-analytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py +++ b/src/log-analytics/azext_loganalytics/tests/latest/test_loganalytics_commands.py @@ -11,9 +11,9 @@ class LogAnalyticsDataClientTests(ScenarioTest): """Test class for Log Analytics data client.""" def test_query(self): """Tests data plane query capabilities for Log Analytics.""" - self.cmd('az monitor log-analytics query --workspace cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"', checks=[ + self.cmd('az monitor log-analytics query --workspace cab864ad-d0c1-496b-bc5e-4418315621bf --analytics-query "Heartbeat | getschema"', checks=[ self.check('tables[0].rows[0][0]', 'TenantId') ]) - query_result = self.cmd('az monitor log-analytics query -w cab864ad-d0c1-496b-bc5e-4418315621bf --kql "Heartbeat | getschema"').get_output_in_json() + query_result = self.cmd('az monitor log-analytics query -w cab864ad-d0c1-496b-bc5e-4418315621bf --analytics-query "Heartbeat | getschema"').get_output_in_json() assert len(query_result['tables'][0]['rows']) == 29 assert isinstance(query_result['tables'][0]['rows'][0][1], (int, float, complex)) From 9dd23c416cd0c625bce2d9ee70586a3682670498 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Fri, 27 Jul 2018 16:14:37 -0700 Subject: [PATCH 23/23] change --kql to --analytics-query, bump version/index/history --- src/index.json | 8 ++++---- src/log-analytics/HISTORY.rst | 5 +++++ src/log-analytics/setup.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/index.json b/src/index.json index 1fa8c1c1443..d497dd84567 100644 --- a/src/index.json +++ b/src/index.json @@ -954,9 +954,9 @@ ], "log-analytics": [ { - "filename": "log_analytics-0.1.1-py2.py3-none-any.whl", - "sha256Digest": "98b88daa6eb978354bbcdc177fba48921186193da0b3f2906fb61845024f352b", - "downloadUrl": "https://files.pythonhosted.org/packages/87/ff/6aff19ead74388299b176b907ec2f0abbd39dbfedf46349ab37476b5f57b/log_analytics-0.1.1-py2.py3-none-any.whl", + "filename": "log_analytics-0.1.2-py2.py3-none-any.whl", + "sha256Digest": "b958800232b5340871999f1e90aa3b198e1be645d5d7553e2f023759912f87a8", + "downloadUrl": "https://files.pythonhosted.org/packages/0c/06/78ddfe634d2af7b35a4931b7a17aea9f026c202316b18f861f462857a2fc/log_analytics-0.1.2-py2.py3-none-any.whl", "metadata": { "azext.isPreview": true, "extensions": { @@ -981,7 +981,7 @@ "metadata_version": "2.0", "name": "log-analytics", "summary": "Support for Azure Log Analytics query capabilities.", - "version": "0.1.1" + "version": "0.1.2" } } ] diff --git a/src/log-analytics/HISTORY.rst b/src/log-analytics/HISTORY.rst index fb96c1b9fda..7e7352aee99 100644 --- a/src/log-analytics/HISTORY.rst +++ b/src/log-analytics/HISTORY.rst @@ -1,3 +1,8 @@ +0.1.2 +++++++++++++++++++ + +* Change --kql to --analytics-query + 0.1.1 ++++++++++++++++++ diff --git a/src/log-analytics/setup.py b/src/log-analytics/setup.py index 7f371c930ad..5890af72e27 100644 --- a/src/log-analytics/setup.py +++ b/src/log-analytics/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.1.1" +VERSION = "0.1.2" CLASSIFIERS = [ 'Development Status :: 4 - Beta',