diff --git a/sdk/loganalytics/azure-loganalytics/MANIFEST.in b/sdk/loganalytics/azure-loganalytics/MANIFEST.in index fd522d8b87da..a8028e2aa06a 100644 --- a/sdk/loganalytics/azure-loganalytics/MANIFEST.in +++ b/sdk/loganalytics/azure-loganalytics/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json include *.md include azure/__init__.py diff --git a/sdk/loganalytics/azure-loganalytics/_meta.json b/sdk/loganalytics/azure-loganalytics/_meta.json new file mode 100644 index 000000000000..77ccf75c217b --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "21d41536f1b5adee299c54ff89c17ece2f87a34f", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/operationalinsights/data-plane/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/operationalinsights/data-plane/readme.md" +} \ No newline at end of file diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/__init__.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/__init__.py index b26c9dd64784..e40d90df6ba1 100644 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/__init__.py +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .log_analytics_data_client import LogAnalyticsDataClient -from .version import VERSION +from ._configuration import LogAnalyticsDataClientConfiguration +from ._log_analytics_data_client import LogAnalyticsDataClient +__all__ = ['LogAnalyticsDataClient', 'LogAnalyticsDataClientConfiguration'] -__all__ = ['LogAnalyticsDataClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/_configuration.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/_configuration.py new file mode 100644 index 000000000000..a38d07ce595f --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/_configuration.py @@ -0,0 +1,43 @@ +# 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 import Configuration + +from .version import VERSION + + +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) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-loganalytics/{}'.format(VERSION)) + + self.credentials = credentials diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/_log_analytics_data_client.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/_log_analytics_data_client.py new file mode 100644 index 000000000000..5048be779bbd --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/_log_analytics_data_client.py @@ -0,0 +1,52 @@ +# 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 Serializer, Deserializer + +from ._configuration import LogAnalyticsDataClientConfiguration +from .operations import QueryOperations +from .operations import MetadataOperations +from . import models + + +class LogAnalyticsDataClient(SDKClient): + """Log Analytics Data Plane Client + + :ivar config: Configuration for client. + :vartype config: LogAnalyticsDataClientConfiguration + + :ivar query: Query operations + :vartype query: azure.loganalytics.operations.QueryOperations + :ivar metadata: Metadata operations + :vartype metadata: azure.loganalytics.operations.MetadataOperations + + :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) + + self.query = QueryOperations( + self._client, self.config, self._serialize, self._deserialize) + self.metadata = MetadataOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/__init__.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/__init__.py index 14fa816d7ba5..a0d9a36c37c1 100644 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/__init__.py +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/__init__.py @@ -10,28 +10,98 @@ # -------------------------------------------------------------------------- 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 + from ._models_py3 import Column + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorInfo + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import MetadataApplication + from ._models_py3 import MetadataApplicationRelated + from ._models_py3 import MetadataCategory + from ._models_py3 import MetadataCategoryRelated + from ._models_py3 import MetadataFunction + from ._models_py3 import MetadataFunctionRelated + from ._models_py3 import MetadataPermissions + from ._models_py3 import MetadataPermissionsApplicationsItem + from ._models_py3 import MetadataPermissionsResourcesItem + from ._models_py3 import MetadataPermissionsWorkspacesItem + from ._models_py3 import MetadataQuery + from ._models_py3 import MetadataQueryRelated + from ._models_py3 import MetadataResourceType + from ._models_py3 import MetadataResourceTypeRelated + from ._models_py3 import MetadataResults + from ._models_py3 import MetadataSolution + from ._models_py3 import MetadataSolutionRelated + from ._models_py3 import MetadataTable + from ._models_py3 import MetadataTableColumnsItem + from ._models_py3 import MetadataTableRelated + from ._models_py3 import MetadataWorkspace + from ._models_py3 import MetadataWorkspaceRelated + from ._models_py3 import QueryBody + from ._models_py3 import QueryResults + from ._models_py3 import Table 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 + from ._models import Column + from ._models import ErrorDetail + from ._models import ErrorInfo + from ._models import ErrorResponse, ErrorResponseException + from ._models import MetadataApplication + from ._models import MetadataApplicationRelated + from ._models import MetadataCategory + from ._models import MetadataCategoryRelated + from ._models import MetadataFunction + from ._models import MetadataFunctionRelated + from ._models import MetadataPermissions + from ._models import MetadataPermissionsApplicationsItem + from ._models import MetadataPermissionsResourcesItem + from ._models import MetadataPermissionsWorkspacesItem + from ._models import MetadataQuery + from ._models import MetadataQueryRelated + from ._models import MetadataResourceType + from ._models import MetadataResourceTypeRelated + from ._models import MetadataResults + from ._models import MetadataSolution + from ._models import MetadataSolutionRelated + from ._models import MetadataTable + from ._models import MetadataTableColumnsItem + from ._models import MetadataTableRelated + from ._models import MetadataWorkspace + from ._models import MetadataWorkspaceRelated + from ._models import QueryBody + from ._models import QueryResults + from ._models import Table +from ._log_analytics_data_client_enums import ( + MetadataColumnDataType, +) __all__ = [ - 'QueryBody', 'Column', - 'Table', - 'QueryResults', 'ErrorDetail', 'ErrorInfo', 'ErrorResponse', 'ErrorResponseException', + 'MetadataApplication', + 'MetadataApplicationRelated', + 'MetadataCategory', + 'MetadataCategoryRelated', + 'MetadataFunction', + 'MetadataFunctionRelated', + 'MetadataPermissions', + 'MetadataPermissionsApplicationsItem', + 'MetadataPermissionsResourcesItem', + 'MetadataPermissionsWorkspacesItem', + 'MetadataQuery', + 'MetadataQueryRelated', + 'MetadataResourceType', + 'MetadataResourceTypeRelated', + 'MetadataResults', + 'MetadataSolution', + 'MetadataSolutionRelated', + 'MetadataTable', + 'MetadataTableColumnsItem', + 'MetadataTableRelated', + 'MetadataWorkspace', + 'MetadataWorkspaceRelated', + 'QueryBody', + 'QueryResults', + 'Table', + 'MetadataColumnDataType', ] diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_log_analytics_data_client_enums.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_log_analytics_data_client_enums.py new file mode 100644 index 000000000000..8bd3404a07f6 --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_log_analytics_data_client_enums.py @@ -0,0 +1,23 @@ +# 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 enum import Enum + + +class MetadataColumnDataType(str, Enum): + + bool_enum = "bool" + datetime_enum = "datetime" + dynamic = "dynamic" + int_enum = "int" + long_enum = "long" + real = "real" + string = "string" diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_models.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_models.py new file mode 100644 index 000000000000..d45d96e137fb --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_models.py @@ -0,0 +1,1153 @@ +# 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 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) + + +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: Additional properties that can be provided + on the error details object + :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) + + +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: Additional properties that can be provided + on the error info object + :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) + + +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) + + +class MetadataApplication(Model): + """An Application Insights application. + + Application Insights apps that were part of the metadata request and that + the user has access to. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Application Insights app. + :type id: str + :param resource_id: Required. The ARM resource ID of the Application + Insights app. + :type resource_id: str + :param name: Required. The name of the Application Insights app. + :type name: str + :param region: Required. The Azure region of the Application Insights app. + :type region: str + :param related: The related metadata items for the Application Insights + app. + :type related: ~azure.loganalytics.models.MetadataApplicationRelated + """ + + _validation = { + 'id': {'required': True}, + 'resource_id': {'required': True}, + 'name': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'related': {'key': 'related', 'type': 'MetadataApplicationRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataApplication, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_id = kwargs.get('resource_id', None) + self.name = kwargs.get('name', None) + self.region = kwargs.get('region', None) + self.related = kwargs.get('related', None) + + +class MetadataApplicationRelated(Model): + """The related metadata items for the Application Insights app. + + :param tables: The related tables for the Application Insights app. + :type tables: list[str] + :param functions: The related functions for the Application Insights app. + :type functions: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataApplicationRelated, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) + self.functions = kwargs.get('functions', None) + + +class MetadataCategory(Model): + """A metadata category. + + Categories are used to group other metadata entities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the category + :type id: str + :param display_name: Required. The display name of the category + :type display_name: str + :param description: The description of the category + :type description: str + :param related: The related metadata items for the category + :type related: ~azure.loganalytics.models.MetadataCategoryRelated + """ + + _validation = { + 'id': {'required': True}, + 'display_name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'related': {'key': 'related', 'type': 'MetadataCategoryRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataCategory, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.related = kwargs.get('related', None) + + +class MetadataCategoryRelated(Model): + """The related metadata items for the category. + + :param tables: The tables related to the category + :type tables: list[str] + :param functions: The functions related to the category + :type functions: list[str] + :param resource_types: The resource types related to the category + :type resource_types: list[str] + :param queries: The saved queries related to the category + :type queries: list[str] + :param solutions: The Log Analytics solutions related to the category + :type solutions: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataCategoryRelated, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) + self.functions = kwargs.get('functions', None) + self.resource_types = kwargs.get('resource_types', None) + self.queries = kwargs.get('queries', None) + self.solutions = kwargs.get('solutions', None) + + +class MetadataFunction(Model): + """A stored function. + + Functions are stored Kusto queries that can be specified as part of queries + by using their name. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the function. + :type id: str + :param name: Required. The name of the function, to be used in queries. + :type name: str + :param parameters: The parameters/arguments of the function, if any. + :type parameters: str + :param display_name: The display name of the function. + :type display_name: str + :param description: The description of the function. + :type description: str + :param body: Required. The KQL body of the function. + :type body: str + :param tags: The tags associated with the function. + :type tags: object + :param properties: The properties of the function. + :type properties: object + :param related: The related metadata items for the function. + :type related: ~azure.loganalytics.models.MetadataFunctionRelated + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'body': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataFunctionRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataFunction, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.parameters = kwargs.get('parameters', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.body = kwargs.get('body', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + self.related = kwargs.get('related', None) + + +class MetadataFunctionRelated(Model): + """The related metadata items for the function. + + :param tables: The related tables for the function. + :type tables: list[str] + :param solutions: The related Log Analytics solutions for the function. + :type solutions: list[str] + :param resource_types: The related resource types for the function. + :type resource_types: list[str] + :param categories: The related categories for the function. + :type categories: list[str] + :param workspaces: The related workspaces for the function. + :type workspaces: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataFunctionRelated, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) + self.solutions = kwargs.get('solutions', None) + self.resource_types = kwargs.get('resource_types', None) + self.categories = kwargs.get('categories', None) + self.workspaces = kwargs.get('workspaces', None) + + +class MetadataPermissions(Model): + """Permission information. + + Permission information for the metadata call, includes + apps/workspaces/resource the user didn't have access to. + + All required parameters must be populated in order to send to Azure. + + :param workspaces: Required. The permission indication for the workspaces + on the metadata request. + :type workspaces: + list[~azure.loganalytics.models.MetadataPermissionsWorkspacesItem] + :param resources: The permission indication for the Azure resources on the + metadata request. + :type resources: + list[~azure.loganalytics.models.MetadataPermissionsResourcesItem] + :param applications: The permission indication for the Application + Insights apps on the metadata request. + :type applications: + list[~azure.loganalytics.models.MetadataPermissionsApplicationsItem] + """ + + _validation = { + 'workspaces': {'required': True}, + } + + _attribute_map = { + 'workspaces': {'key': 'workspaces', 'type': '[MetadataPermissionsWorkspacesItem]'}, + 'resources': {'key': 'resources', 'type': '[MetadataPermissionsResourcesItem]'}, + 'applications': {'key': 'applications', 'type': '[MetadataPermissionsApplicationsItem]'}, + } + + def __init__(self, **kwargs): + super(MetadataPermissions, self).__init__(**kwargs) + self.workspaces = kwargs.get('workspaces', None) + self.resources = kwargs.get('resources', None) + self.applications = kwargs.get('applications', None) + + +class MetadataPermissionsApplicationsItem(Model): + """MetadataPermissionsApplicationsItem. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource ID on the permission + indication. + :type resource_id: str + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetadataPermissionsApplicationsItem, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + + +class MetadataPermissionsResourcesItem(Model): + """MetadataPermissionsResourcesItem. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource ID on the permission + indication. + :type resource_id: str + :param deny_tables: The list of tables that were denied access for the + resource ID. + :type deny_tables: list[str] + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'deny_tables': {'key': 'denyTables', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataPermissionsResourcesItem, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.deny_tables = kwargs.get('deny_tables', None) + + +class MetadataPermissionsWorkspacesItem(Model): + """MetadataPermissionsWorkspacesItem. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource ID on the permission + indication. + :type resource_id: str + :param deny_tables: The list of tables that were denied access for the + resource ID. + :type deny_tables: list[str] + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'deny_tables': {'key': 'denyTables', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataPermissionsWorkspacesItem, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.deny_tables = kwargs.get('deny_tables', None) + + +class MetadataQuery(Model): + """A stored query. + + Queries are stored pieces of KQL, along with a list of relevant metadata + items. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the query. + :type id: str + :param display_name: The display name of the query. + :type display_name: str + :param description: The description of the query. + :type description: str + :param body: Required. The KQL body of the query. + :type body: str + :param labels: The user defined labels associated with the query. + :type labels: list[str] + :param tags: The tags associated with the query. + :type tags: object + :param properties: The properties of the query. + :type properties: object + :param related: The related metadata items for the query. + :type related: ~azure.loganalytics.models.MetadataQueryRelated + """ + + _validation = { + 'id': {'required': True}, + 'body': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'labels': {'key': 'labels', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataQueryRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataQuery, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.body = kwargs.get('body', None) + self.labels = kwargs.get('labels', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + self.related = kwargs.get('related', None) + + +class MetadataQueryRelated(Model): + """The related metadata items for the query. + + :param categories: The related categories for the query. + :type categories: list[str] + :param solutions: The related Log Analytics solutions for the query. + :type solutions: list[str] + :param resource_types: The related resource types for the query. + :type resource_types: list[str] + :param tables: The related tables for the query. + :type tables: list[str] + """ + + _attribute_map = { + 'categories': {'key': 'categories', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'tables': {'key': 'tables', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataQueryRelated, self).__init__(**kwargs) + self.categories = kwargs.get('categories', None) + self.solutions = kwargs.get('solutions', None) + self.resource_types = kwargs.get('resource_types', None) + self.tables = kwargs.get('tables', None) + + +class MetadataResourceType(Model): + """A type of resource in Azure. + + Metadata about types of Azure resources, containing relevant tables, + functions, etc. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the resource-type + :type id: str + :param type: Required. The type of the resource-type + :type type: str + :param display_name: The display name of the resource-type + :type display_name: str + :param description: The description of the resource-type + :type description: str + :param labels: The user-defined labels of the resource-type + :type labels: list[str] + :param tags: The tags associated with the resource-type + :type tags: object + :param properties: The properties of the resource-type + :type properties: object + :param related: The related metadata items for the resource-type + :type related: ~azure.loganalytics.models.MetadataResourceTypeRelated + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'labels': {'key': 'labels', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataResourceTypeRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataResourceType, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.labels = kwargs.get('labels', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + self.related = kwargs.get('related', None) + + +class MetadataResourceTypeRelated(Model): + """The related metadata items for the resource-type. + + :param tables: The tables related to the resource-type + :type tables: list[str] + :param functions: The functions related to the resource-type + :type functions: list[str] + :param categories: The categories related to the resource-type + :type categories: list[str] + :param queries: The queries related to the resource-type + :type queries: list[str] + :param workspaces: The Log Analytics workspaces related to the + resource-type + :type workspaces: list[str] + :param resources: The Azure resources related to the resource-type + :type resources: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataResourceTypeRelated, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) + self.functions = kwargs.get('functions', None) + self.categories = kwargs.get('categories', None) + self.queries = kwargs.get('queries', None) + self.workspaces = kwargs.get('workspaces', None) + self.resources = kwargs.get('resources', None) + + +class MetadataResults(Model): + """A metadata response. + + The metadata response for the app, including available tables, etc. + + :param categories: The list of categories that are referenced in this + metadata response. + :type categories: list[~azure.loganalytics.models.MetadataCategory] + :param resource_types: The list of resource types that are referenced in + this metadata response. + :type resource_types: + list[~azure.loganalytics.models.MetadataResourceType] + :param solutions: The list of Log Analytics solutions installed on the + workspace. + :type solutions: list[~azure.loganalytics.models.MetadataSolution] + :param tables: The list of tables and columns that comprise the schema of + the workspace. + :type tables: list[~azure.loganalytics.models.MetadataTable] + :param functions: The list of functions stored on the workspace, or + introduced by solutions etc. + :type functions: list[~azure.loganalytics.models.MetadataFunction] + :param queries: The list of saved queries stored on the workspace, or + introduced by solutions, resource types, etc. + :type queries: list[~azure.loganalytics.models.MetadataQuery] + :param applications: The list of Application Insights apps that were + referenced in the metadata request. + :type applications: list[~azure.loganalytics.models.MetadataApplication] + :param workspaces: The list of Log Analytics workspaces that were + referenced in the metadata request. + :type workspaces: list[~azure.loganalytics.models.MetadataWorkspace] + :param resources: The list of Azure resources that were referenced in the + metadata request. + :type resources: list[object] + :param permissions: The list of permission rules that affected the + metadata request. + :type permissions: list[~azure.loganalytics.models.MetadataPermissions] + """ + + _validation = { + 'categories': {'unique': True}, + 'resource_types': {'unique': True}, + 'solutions': {'unique': True}, + 'tables': {'unique': True}, + 'functions': {'unique': True}, + 'queries': {'unique': True}, + 'applications': {'unique': True}, + 'workspaces': {'unique': True}, + 'resources': {'unique': True}, + 'permissions': {'unique': True}, + } + + _attribute_map = { + 'categories': {'key': 'categories', 'type': '[MetadataCategory]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[MetadataResourceType]'}, + 'solutions': {'key': 'solutions', 'type': '[MetadataSolution]'}, + 'tables': {'key': 'tables', 'type': '[MetadataTable]'}, + 'functions': {'key': 'functions', 'type': '[MetadataFunction]'}, + 'queries': {'key': 'queries', 'type': '[MetadataQuery]'}, + 'applications': {'key': 'applications', 'type': '[MetadataApplication]'}, + 'workspaces': {'key': 'workspaces', 'type': '[MetadataWorkspace]'}, + 'resources': {'key': 'resources', 'type': '[object]'}, + 'permissions': {'key': 'permissions', 'type': '[MetadataPermissions]'}, + } + + def __init__(self, **kwargs): + super(MetadataResults, self).__init__(**kwargs) + self.categories = kwargs.get('categories', None) + self.resource_types = kwargs.get('resource_types', None) + self.solutions = kwargs.get('solutions', None) + self.tables = kwargs.get('tables', None) + self.functions = kwargs.get('functions', None) + self.queries = kwargs.get('queries', None) + self.applications = kwargs.get('applications', None) + self.workspaces = kwargs.get('workspaces', None) + self.resources = kwargs.get('resources', None) + self.permissions = kwargs.get('permissions', None) + + +class MetadataSolution(Model): + """A Log Analytics solution. + + Solutions can group tables and functions that are associated with a certain + Azure Log Analytics offering. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Log Analytics solution + :type id: str + :param name: Required. The name of the Log Analytics solution + :type name: str + :param display_name: The display name of the Log Analytics solution + :type display_name: str + :param description: The description of the Log Analytics solution + :type description: str + :param tags: The tags that are associated with the Log Analytics solution + :type tags: object + :param properties: The properties of the Log Analytics solution + :type properties: object + :param related: Required. The related metadata items for the Log Analytics + solution + :type related: ~azure.loganalytics.models.MetadataSolutionRelated + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'related': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataSolutionRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataSolution, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + self.related = kwargs.get('related', None) + + +class MetadataSolutionRelated(Model): + """The related metadata items for the Log Analytics solution. + + All required parameters must be populated in order to send to Azure. + + :param tables: Required. The tables related to the Log Analytics solution + :type tables: list[str] + :param functions: The functions related to the Log Analytics solution + :type functions: list[str] + :param categories: The categories related to the Log Analytics solution + :type categories: list[str] + :param queries: The saved queries related to the Log Analytics solution + :type queries: list[str] + :param workspaces: The Workspaces referenced in the metadata request that + are related to the Log Analytics solution + :type workspaces: list[str] + """ + + _validation = { + 'tables': {'required': True}, + } + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataSolutionRelated, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) + self.functions = kwargs.get('functions', None) + self.categories = kwargs.get('categories', None) + self.queries = kwargs.get('queries', None) + self.workspaces = kwargs.get('workspaces', None) + + +class MetadataTable(Model): + """A data table that takes part in a workspace schema. + + Tables are part of the workspace schema, and contain a list of columns and + a reference to other relevant metadata items. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the table + :type id: str + :param name: Required. The name of the table + :type name: str + :param description: The description of the table + :type description: str + :param timespan_column: The column associated with the timespan query + parameter for the table + :type timespan_column: str + :param labels: The user defined labels of the table + :type labels: list[str] + :param tags: The tags associated with the table + :type tags: object + :param properties: The properties of the table + :type properties: object + :param columns: The list of columns defined on the table + :type columns: list[~azure.loganalytics.models.MetadataTableColumnsItem] + :param related: The related metadata items for the table + :type related: ~azure.loganalytics.models.MetadataTableRelated + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'timespan_column': {'key': 'timespanColumn', 'type': 'str'}, + 'labels': {'key': 'labels', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'columns': {'key': 'columns', 'type': '[MetadataTableColumnsItem]'}, + 'related': {'key': 'related', 'type': 'MetadataTableRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataTable, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.timespan_column = kwargs.get('timespan_column', None) + self.labels = kwargs.get('labels', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + self.columns = kwargs.get('columns', None) + self.related = kwargs.get('related', None) + + +class MetadataTableColumnsItem(Model): + """MetadataTableColumnsItem. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column + :type name: str + :param description: The description of the column + :type description: str + :param type: Required. The data type of the column. Possible values + include: 'bool', 'datetime', 'dynamic', 'int', 'long', 'real', 'string' + :type type: str or ~azure.loganalytics.models.MetadataColumnDataType + :param is_preferred_facet: A flag indicating this column is a preferred + facet + :type is_preferred_facet: bool + :param source: an indication of the source of the column, used only when + multiple workspaces have conflicting definition for the column + :type source: object + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'is_preferred_facet': {'key': 'isPreferredFacet', 'type': 'bool'}, + 'source': {'key': 'source', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(MetadataTableColumnsItem, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.type = kwargs.get('type', None) + self.is_preferred_facet = kwargs.get('is_preferred_facet', None) + self.source = kwargs.get('source', None) + + +class MetadataTableRelated(Model): + """The related metadata items for the table. + + :param categories: The related categories for the table + :type categories: list[str] + :param solutions: The related Log Analytics solutions for the table + :type solutions: list[str] + :param resource_types: The related resource types for the table + :type resource_types: list[str] + :param workspaces: The related Log Analytics workspaces for the table + :type workspaces: list[str] + :param functions: The related functions for the table + :type functions: list[str] + :param queries: The related saved queries for the table + :type queries: list[str] + """ + + _attribute_map = { + 'categories': {'key': 'categories', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataTableRelated, self).__init__(**kwargs) + self.categories = kwargs.get('categories', None) + self.solutions = kwargs.get('solutions', None) + self.resource_types = kwargs.get('resource_types', None) + self.workspaces = kwargs.get('workspaces', None) + self.functions = kwargs.get('functions', None) + self.queries = kwargs.get('queries', None) + + +class MetadataWorkspace(Model): + """A Log Analytics workspace. + + Log Analytics workspaces that were part of the metadata request and that + the user has access to. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Log Analytics workspace. + :type id: str + :param resource_id: Required. The ARM resource ID of the Log Analytics + workspace. + :type resource_id: str + :param name: Required. The name of the Log Analytics workspace. + :type name: str + :param region: Required. The Azure region of the Log Analytics workspace. + :type region: str + :param related: The related metadata items for the Log Analytics + workspace. + :type related: ~azure.loganalytics.models.MetadataWorkspaceRelated + """ + + _validation = { + 'id': {'required': True}, + 'resource_id': {'required': True}, + 'name': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'related': {'key': 'related', 'type': 'MetadataWorkspaceRelated'}, + } + + def __init__(self, **kwargs): + super(MetadataWorkspace, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_id = kwargs.get('resource_id', None) + self.name = kwargs.get('name', None) + self.region = kwargs.get('region', None) + self.related = kwargs.get('related', None) + + +class MetadataWorkspaceRelated(Model): + """The related metadata items for the Log Analytics workspace. + + :param tables: The related tables for the Log Analytics workspace. + :type tables: list[str] + :param solutions: The related Log Analytics solutions for the Log + Analytics workspace. + :type solutions: list[str] + :param resource_types: The related resource types for the Log Analytics + workspace. + :type resource_types: list[str] + :param functions: The related functions for the Log Analytics workspace. + :type functions: list[str] + :param resources: The related Azure resources for the Log Analytics + workspace. + :type resources: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(MetadataWorkspaceRelated, self).__init__(**kwargs) + self.tables = kwargs.get('tables', None) + self.solutions = kwargs.get('solutions', None) + self.resource_types = kwargs.get('resource_types', None) + self.functions = kwargs.get('functions', None) + self.resources = kwargs.get('resources', None) + + +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) + + +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) + + +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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_models_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_models_py3.py new file mode 100644 index 000000000000..8b71752abd24 --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/_models_py3.py @@ -0,0 +1,1153 @@ +# 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 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 + + +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: Additional properties that can be provided + on the error details object + :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 + + +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: Additional properties that can be provided + on the error info object + :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 + + +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) + + +class MetadataApplication(Model): + """An Application Insights application. + + Application Insights apps that were part of the metadata request and that + the user has access to. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Application Insights app. + :type id: str + :param resource_id: Required. The ARM resource ID of the Application + Insights app. + :type resource_id: str + :param name: Required. The name of the Application Insights app. + :type name: str + :param region: Required. The Azure region of the Application Insights app. + :type region: str + :param related: The related metadata items for the Application Insights + app. + :type related: ~azure.loganalytics.models.MetadataApplicationRelated + """ + + _validation = { + 'id': {'required': True}, + 'resource_id': {'required': True}, + 'name': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'related': {'key': 'related', 'type': 'MetadataApplicationRelated'}, + } + + def __init__(self, *, id: str, resource_id: str, name: str, region: str, related=None, **kwargs) -> None: + super(MetadataApplication, self).__init__(**kwargs) + self.id = id + self.resource_id = resource_id + self.name = name + self.region = region + self.related = related + + +class MetadataApplicationRelated(Model): + """The related metadata items for the Application Insights app. + + :param tables: The related tables for the Application Insights app. + :type tables: list[str] + :param functions: The related functions for the Application Insights app. + :type functions: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + } + + def __init__(self, *, tables=None, functions=None, **kwargs) -> None: + super(MetadataApplicationRelated, self).__init__(**kwargs) + self.tables = tables + self.functions = functions + + +class MetadataCategory(Model): + """A metadata category. + + Categories are used to group other metadata entities. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the category + :type id: str + :param display_name: Required. The display name of the category + :type display_name: str + :param description: The description of the category + :type description: str + :param related: The related metadata items for the category + :type related: ~azure.loganalytics.models.MetadataCategoryRelated + """ + + _validation = { + 'id': {'required': True}, + 'display_name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'related': {'key': 'related', 'type': 'MetadataCategoryRelated'}, + } + + def __init__(self, *, id: str, display_name: str, description: str=None, related=None, **kwargs) -> None: + super(MetadataCategory, self).__init__(**kwargs) + self.id = id + self.display_name = display_name + self.description = description + self.related = related + + +class MetadataCategoryRelated(Model): + """The related metadata items for the category. + + :param tables: The tables related to the category + :type tables: list[str] + :param functions: The functions related to the category + :type functions: list[str] + :param resource_types: The resource types related to the category + :type resource_types: list[str] + :param queries: The saved queries related to the category + :type queries: list[str] + :param solutions: The Log Analytics solutions related to the category + :type solutions: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + } + + def __init__(self, *, tables=None, functions=None, resource_types=None, queries=None, solutions=None, **kwargs) -> None: + super(MetadataCategoryRelated, self).__init__(**kwargs) + self.tables = tables + self.functions = functions + self.resource_types = resource_types + self.queries = queries + self.solutions = solutions + + +class MetadataFunction(Model): + """A stored function. + + Functions are stored Kusto queries that can be specified as part of queries + by using their name. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the function. + :type id: str + :param name: Required. The name of the function, to be used in queries. + :type name: str + :param parameters: The parameters/arguments of the function, if any. + :type parameters: str + :param display_name: The display name of the function. + :type display_name: str + :param description: The description of the function. + :type description: str + :param body: Required. The KQL body of the function. + :type body: str + :param tags: The tags associated with the function. + :type tags: object + :param properties: The properties of the function. + :type properties: object + :param related: The related metadata items for the function. + :type related: ~azure.loganalytics.models.MetadataFunctionRelated + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'body': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataFunctionRelated'}, + } + + def __init__(self, *, id: str, name: str, body: str, parameters: str=None, display_name: str=None, description: str=None, tags=None, properties=None, related=None, **kwargs) -> None: + super(MetadataFunction, self).__init__(**kwargs) + self.id = id + self.name = name + self.parameters = parameters + self.display_name = display_name + self.description = description + self.body = body + self.tags = tags + self.properties = properties + self.related = related + + +class MetadataFunctionRelated(Model): + """The related metadata items for the function. + + :param tables: The related tables for the function. + :type tables: list[str] + :param solutions: The related Log Analytics solutions for the function. + :type solutions: list[str] + :param resource_types: The related resource types for the function. + :type resource_types: list[str] + :param categories: The related categories for the function. + :type categories: list[str] + :param workspaces: The related workspaces for the function. + :type workspaces: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + } + + def __init__(self, *, tables=None, solutions=None, resource_types=None, categories=None, workspaces=None, **kwargs) -> None: + super(MetadataFunctionRelated, self).__init__(**kwargs) + self.tables = tables + self.solutions = solutions + self.resource_types = resource_types + self.categories = categories + self.workspaces = workspaces + + +class MetadataPermissions(Model): + """Permission information. + + Permission information for the metadata call, includes + apps/workspaces/resource the user didn't have access to. + + All required parameters must be populated in order to send to Azure. + + :param workspaces: Required. The permission indication for the workspaces + on the metadata request. + :type workspaces: + list[~azure.loganalytics.models.MetadataPermissionsWorkspacesItem] + :param resources: The permission indication for the Azure resources on the + metadata request. + :type resources: + list[~azure.loganalytics.models.MetadataPermissionsResourcesItem] + :param applications: The permission indication for the Application + Insights apps on the metadata request. + :type applications: + list[~azure.loganalytics.models.MetadataPermissionsApplicationsItem] + """ + + _validation = { + 'workspaces': {'required': True}, + } + + _attribute_map = { + 'workspaces': {'key': 'workspaces', 'type': '[MetadataPermissionsWorkspacesItem]'}, + 'resources': {'key': 'resources', 'type': '[MetadataPermissionsResourcesItem]'}, + 'applications': {'key': 'applications', 'type': '[MetadataPermissionsApplicationsItem]'}, + } + + def __init__(self, *, workspaces, resources=None, applications=None, **kwargs) -> None: + super(MetadataPermissions, self).__init__(**kwargs) + self.workspaces = workspaces + self.resources = resources + self.applications = applications + + +class MetadataPermissionsApplicationsItem(Model): + """MetadataPermissionsApplicationsItem. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource ID on the permission + indication. + :type resource_id: str + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + } + + def __init__(self, *, resource_id: str, **kwargs) -> None: + super(MetadataPermissionsApplicationsItem, self).__init__(**kwargs) + self.resource_id = resource_id + + +class MetadataPermissionsResourcesItem(Model): + """MetadataPermissionsResourcesItem. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource ID on the permission + indication. + :type resource_id: str + :param deny_tables: The list of tables that were denied access for the + resource ID. + :type deny_tables: list[str] + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'deny_tables': {'key': 'denyTables', 'type': '[str]'}, + } + + def __init__(self, *, resource_id: str, deny_tables=None, **kwargs) -> None: + super(MetadataPermissionsResourcesItem, self).__init__(**kwargs) + self.resource_id = resource_id + self.deny_tables = deny_tables + + +class MetadataPermissionsWorkspacesItem(Model): + """MetadataPermissionsWorkspacesItem. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. The resource ID on the permission + indication. + :type resource_id: str + :param deny_tables: The list of tables that were denied access for the + resource ID. + :type deny_tables: list[str] + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'deny_tables': {'key': 'denyTables', 'type': '[str]'}, + } + + def __init__(self, *, resource_id: str, deny_tables=None, **kwargs) -> None: + super(MetadataPermissionsWorkspacesItem, self).__init__(**kwargs) + self.resource_id = resource_id + self.deny_tables = deny_tables + + +class MetadataQuery(Model): + """A stored query. + + Queries are stored pieces of KQL, along with a list of relevant metadata + items. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the query. + :type id: str + :param display_name: The display name of the query. + :type display_name: str + :param description: The description of the query. + :type description: str + :param body: Required. The KQL body of the query. + :type body: str + :param labels: The user defined labels associated with the query. + :type labels: list[str] + :param tags: The tags associated with the query. + :type tags: object + :param properties: The properties of the query. + :type properties: object + :param related: The related metadata items for the query. + :type related: ~azure.loganalytics.models.MetadataQueryRelated + """ + + _validation = { + 'id': {'required': True}, + 'body': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'str'}, + 'labels': {'key': 'labels', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataQueryRelated'}, + } + + def __init__(self, *, id: str, body: str, display_name: str=None, description: str=None, labels=None, tags=None, properties=None, related=None, **kwargs) -> None: + super(MetadataQuery, self).__init__(**kwargs) + self.id = id + self.display_name = display_name + self.description = description + self.body = body + self.labels = labels + self.tags = tags + self.properties = properties + self.related = related + + +class MetadataQueryRelated(Model): + """The related metadata items for the query. + + :param categories: The related categories for the query. + :type categories: list[str] + :param solutions: The related Log Analytics solutions for the query. + :type solutions: list[str] + :param resource_types: The related resource types for the query. + :type resource_types: list[str] + :param tables: The related tables for the query. + :type tables: list[str] + """ + + _attribute_map = { + 'categories': {'key': 'categories', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'tables': {'key': 'tables', 'type': '[str]'}, + } + + def __init__(self, *, categories=None, solutions=None, resource_types=None, tables=None, **kwargs) -> None: + super(MetadataQueryRelated, self).__init__(**kwargs) + self.categories = categories + self.solutions = solutions + self.resource_types = resource_types + self.tables = tables + + +class MetadataResourceType(Model): + """A type of resource in Azure. + + Metadata about types of Azure resources, containing relevant tables, + functions, etc. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the resource-type + :type id: str + :param type: Required. The type of the resource-type + :type type: str + :param display_name: The display name of the resource-type + :type display_name: str + :param description: The description of the resource-type + :type description: str + :param labels: The user-defined labels of the resource-type + :type labels: list[str] + :param tags: The tags associated with the resource-type + :type tags: object + :param properties: The properties of the resource-type + :type properties: object + :param related: The related metadata items for the resource-type + :type related: ~azure.loganalytics.models.MetadataResourceTypeRelated + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'labels': {'key': 'labels', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataResourceTypeRelated'}, + } + + def __init__(self, *, id: str, type: str, display_name: str=None, description: str=None, labels=None, tags=None, properties=None, related=None, **kwargs) -> None: + super(MetadataResourceType, self).__init__(**kwargs) + self.id = id + self.type = type + self.display_name = display_name + self.description = description + self.labels = labels + self.tags = tags + self.properties = properties + self.related = related + + +class MetadataResourceTypeRelated(Model): + """The related metadata items for the resource-type. + + :param tables: The tables related to the resource-type + :type tables: list[str] + :param functions: The functions related to the resource-type + :type functions: list[str] + :param categories: The categories related to the resource-type + :type categories: list[str] + :param queries: The queries related to the resource-type + :type queries: list[str] + :param workspaces: The Log Analytics workspaces related to the + resource-type + :type workspaces: list[str] + :param resources: The Azure resources related to the resource-type + :type resources: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + } + + def __init__(self, *, tables=None, functions=None, categories=None, queries=None, workspaces=None, resources=None, **kwargs) -> None: + super(MetadataResourceTypeRelated, self).__init__(**kwargs) + self.tables = tables + self.functions = functions + self.categories = categories + self.queries = queries + self.workspaces = workspaces + self.resources = resources + + +class MetadataResults(Model): + """A metadata response. + + The metadata response for the app, including available tables, etc. + + :param categories: The list of categories that are referenced in this + metadata response. + :type categories: list[~azure.loganalytics.models.MetadataCategory] + :param resource_types: The list of resource types that are referenced in + this metadata response. + :type resource_types: + list[~azure.loganalytics.models.MetadataResourceType] + :param solutions: The list of Log Analytics solutions installed on the + workspace. + :type solutions: list[~azure.loganalytics.models.MetadataSolution] + :param tables: The list of tables and columns that comprise the schema of + the workspace. + :type tables: list[~azure.loganalytics.models.MetadataTable] + :param functions: The list of functions stored on the workspace, or + introduced by solutions etc. + :type functions: list[~azure.loganalytics.models.MetadataFunction] + :param queries: The list of saved queries stored on the workspace, or + introduced by solutions, resource types, etc. + :type queries: list[~azure.loganalytics.models.MetadataQuery] + :param applications: The list of Application Insights apps that were + referenced in the metadata request. + :type applications: list[~azure.loganalytics.models.MetadataApplication] + :param workspaces: The list of Log Analytics workspaces that were + referenced in the metadata request. + :type workspaces: list[~azure.loganalytics.models.MetadataWorkspace] + :param resources: The list of Azure resources that were referenced in the + metadata request. + :type resources: list[object] + :param permissions: The list of permission rules that affected the + metadata request. + :type permissions: list[~azure.loganalytics.models.MetadataPermissions] + """ + + _validation = { + 'categories': {'unique': True}, + 'resource_types': {'unique': True}, + 'solutions': {'unique': True}, + 'tables': {'unique': True}, + 'functions': {'unique': True}, + 'queries': {'unique': True}, + 'applications': {'unique': True}, + 'workspaces': {'unique': True}, + 'resources': {'unique': True}, + 'permissions': {'unique': True}, + } + + _attribute_map = { + 'categories': {'key': 'categories', 'type': '[MetadataCategory]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[MetadataResourceType]'}, + 'solutions': {'key': 'solutions', 'type': '[MetadataSolution]'}, + 'tables': {'key': 'tables', 'type': '[MetadataTable]'}, + 'functions': {'key': 'functions', 'type': '[MetadataFunction]'}, + 'queries': {'key': 'queries', 'type': '[MetadataQuery]'}, + 'applications': {'key': 'applications', 'type': '[MetadataApplication]'}, + 'workspaces': {'key': 'workspaces', 'type': '[MetadataWorkspace]'}, + 'resources': {'key': 'resources', 'type': '[object]'}, + 'permissions': {'key': 'permissions', 'type': '[MetadataPermissions]'}, + } + + def __init__(self, *, categories=None, resource_types=None, solutions=None, tables=None, functions=None, queries=None, applications=None, workspaces=None, resources=None, permissions=None, **kwargs) -> None: + super(MetadataResults, self).__init__(**kwargs) + self.categories = categories + self.resource_types = resource_types + self.solutions = solutions + self.tables = tables + self.functions = functions + self.queries = queries + self.applications = applications + self.workspaces = workspaces + self.resources = resources + self.permissions = permissions + + +class MetadataSolution(Model): + """A Log Analytics solution. + + Solutions can group tables and functions that are associated with a certain + Azure Log Analytics offering. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Log Analytics solution + :type id: str + :param name: Required. The name of the Log Analytics solution + :type name: str + :param display_name: The display name of the Log Analytics solution + :type display_name: str + :param description: The description of the Log Analytics solution + :type description: str + :param tags: The tags that are associated with the Log Analytics solution + :type tags: object + :param properties: The properties of the Log Analytics solution + :type properties: object + :param related: Required. The related metadata items for the Log Analytics + solution + :type related: ~azure.loganalytics.models.MetadataSolutionRelated + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + 'related': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'related': {'key': 'related', 'type': 'MetadataSolutionRelated'}, + } + + def __init__(self, *, id: str, name: str, related, display_name: str=None, description: str=None, tags=None, properties=None, **kwargs) -> None: + super(MetadataSolution, self).__init__(**kwargs) + self.id = id + self.name = name + self.display_name = display_name + self.description = description + self.tags = tags + self.properties = properties + self.related = related + + +class MetadataSolutionRelated(Model): + """The related metadata items for the Log Analytics solution. + + All required parameters must be populated in order to send to Azure. + + :param tables: Required. The tables related to the Log Analytics solution + :type tables: list[str] + :param functions: The functions related to the Log Analytics solution + :type functions: list[str] + :param categories: The categories related to the Log Analytics solution + :type categories: list[str] + :param queries: The saved queries related to the Log Analytics solution + :type queries: list[str] + :param workspaces: The Workspaces referenced in the metadata request that + are related to the Log Analytics solution + :type workspaces: list[str] + """ + + _validation = { + 'tables': {'required': True}, + } + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + } + + def __init__(self, *, tables, functions=None, categories=None, queries=None, workspaces=None, **kwargs) -> None: + super(MetadataSolutionRelated, self).__init__(**kwargs) + self.tables = tables + self.functions = functions + self.categories = categories + self.queries = queries + self.workspaces = workspaces + + +class MetadataTable(Model): + """A data table that takes part in a workspace schema. + + Tables are part of the workspace schema, and contain a list of columns and + a reference to other relevant metadata items. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the table + :type id: str + :param name: Required. The name of the table + :type name: str + :param description: The description of the table + :type description: str + :param timespan_column: The column associated with the timespan query + parameter for the table + :type timespan_column: str + :param labels: The user defined labels of the table + :type labels: list[str] + :param tags: The tags associated with the table + :type tags: object + :param properties: The properties of the table + :type properties: object + :param columns: The list of columns defined on the table + :type columns: list[~azure.loganalytics.models.MetadataTableColumnsItem] + :param related: The related metadata items for the table + :type related: ~azure.loganalytics.models.MetadataTableRelated + """ + + _validation = { + 'id': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'timespan_column': {'key': 'timespanColumn', 'type': 'str'}, + 'labels': {'key': 'labels', 'type': '[str]'}, + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'columns': {'key': 'columns', 'type': '[MetadataTableColumnsItem]'}, + 'related': {'key': 'related', 'type': 'MetadataTableRelated'}, + } + + def __init__(self, *, id: str, name: str, description: str=None, timespan_column: str=None, labels=None, tags=None, properties=None, columns=None, related=None, **kwargs) -> None: + super(MetadataTable, self).__init__(**kwargs) + self.id = id + self.name = name + self.description = description + self.timespan_column = timespan_column + self.labels = labels + self.tags = tags + self.properties = properties + self.columns = columns + self.related = related + + +class MetadataTableColumnsItem(Model): + """MetadataTableColumnsItem. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the column + :type name: str + :param description: The description of the column + :type description: str + :param type: Required. The data type of the column. Possible values + include: 'bool', 'datetime', 'dynamic', 'int', 'long', 'real', 'string' + :type type: str or ~azure.loganalytics.models.MetadataColumnDataType + :param is_preferred_facet: A flag indicating this column is a preferred + facet + :type is_preferred_facet: bool + :param source: an indication of the source of the column, used only when + multiple workspaces have conflicting definition for the column + :type source: object + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'is_preferred_facet': {'key': 'isPreferredFacet', 'type': 'bool'}, + 'source': {'key': 'source', 'type': 'object'}, + } + + def __init__(self, *, name: str, type, description: str=None, is_preferred_facet: bool=None, source=None, **kwargs) -> None: + super(MetadataTableColumnsItem, self).__init__(**kwargs) + self.name = name + self.description = description + self.type = type + self.is_preferred_facet = is_preferred_facet + self.source = source + + +class MetadataTableRelated(Model): + """The related metadata items for the table. + + :param categories: The related categories for the table + :type categories: list[str] + :param solutions: The related Log Analytics solutions for the table + :type solutions: list[str] + :param resource_types: The related resource types for the table + :type resource_types: list[str] + :param workspaces: The related Log Analytics workspaces for the table + :type workspaces: list[str] + :param functions: The related functions for the table + :type functions: list[str] + :param queries: The related saved queries for the table + :type queries: list[str] + """ + + _attribute_map = { + 'categories': {'key': 'categories', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'workspaces': {'key': 'workspaces', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'queries': {'key': 'queries', 'type': '[str]'}, + } + + def __init__(self, *, categories=None, solutions=None, resource_types=None, workspaces=None, functions=None, queries=None, **kwargs) -> None: + super(MetadataTableRelated, self).__init__(**kwargs) + self.categories = categories + self.solutions = solutions + self.resource_types = resource_types + self.workspaces = workspaces + self.functions = functions + self.queries = queries + + +class MetadataWorkspace(Model): + """A Log Analytics workspace. + + Log Analytics workspaces that were part of the metadata request and that + the user has access to. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The ID of the Log Analytics workspace. + :type id: str + :param resource_id: Required. The ARM resource ID of the Log Analytics + workspace. + :type resource_id: str + :param name: Required. The name of the Log Analytics workspace. + :type name: str + :param region: Required. The Azure region of the Log Analytics workspace. + :type region: str + :param related: The related metadata items for the Log Analytics + workspace. + :type related: ~azure.loganalytics.models.MetadataWorkspaceRelated + """ + + _validation = { + 'id': {'required': True}, + 'resource_id': {'required': True}, + 'name': {'required': True}, + 'region': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'region': {'key': 'region', 'type': 'str'}, + 'related': {'key': 'related', 'type': 'MetadataWorkspaceRelated'}, + } + + def __init__(self, *, id: str, resource_id: str, name: str, region: str, related=None, **kwargs) -> None: + super(MetadataWorkspace, self).__init__(**kwargs) + self.id = id + self.resource_id = resource_id + self.name = name + self.region = region + self.related = related + + +class MetadataWorkspaceRelated(Model): + """The related metadata items for the Log Analytics workspace. + + :param tables: The related tables for the Log Analytics workspace. + :type tables: list[str] + :param solutions: The related Log Analytics solutions for the Log + Analytics workspace. + :type solutions: list[str] + :param resource_types: The related resource types for the Log Analytics + workspace. + :type resource_types: list[str] + :param functions: The related functions for the Log Analytics workspace. + :type functions: list[str] + :param resources: The related Azure resources for the Log Analytics + workspace. + :type resources: list[str] + """ + + _attribute_map = { + 'tables': {'key': 'tables', 'type': '[str]'}, + 'solutions': {'key': 'solutions', 'type': '[str]'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[str]'}, + 'functions': {'key': 'functions', 'type': '[str]'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + } + + def __init__(self, *, tables=None, solutions=None, resource_types=None, functions=None, resources=None, **kwargs) -> None: + super(MetadataWorkspaceRelated, self).__init__(**kwargs) + self.tables = tables + self.solutions = solutions + self.resource_types = resource_types + self.functions = functions + self.resources = resources + + +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 + + +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 + + +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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/column.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/column.py deleted file mode 100644 index fde9b294d351..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/column.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/column_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/column_py3.py deleted file mode 100644 index 4df2ac58398f..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/column_py3.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_detail.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_detail.py deleted file mode 100644 index 3fd620dffa45..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_detail.py +++ /dev/null @@ -1,58 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_detail_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_detail_py3.py deleted file mode 100644 index 8c714de89d18..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_detail_py3.py +++ /dev/null @@ -1,58 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_info.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_info.py deleted file mode 100644 index 60b1bff092d7..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_info.py +++ /dev/null @@ -1,51 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_info_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_info_py3.py deleted file mode 100644 index 1692b9d1696a..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_info_py3.py +++ /dev/null @@ -1,51 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_response.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_response.py deleted file mode 100644 index 8ecb3f3ed702..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_response.py +++ /dev/null @@ -1,49 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_response_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_response_py3.py deleted file mode 100644 index d12bb2b0a344..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/error_response_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_body.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_body.py deleted file mode 100644 index 255d440bed40..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_body.py +++ /dev/null @@ -1,45 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_body_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_body_py3.py deleted file mode 100644 index 65d455bd0103..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_body_py3.py +++ /dev/null @@ -1,45 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_results.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_results.py deleted file mode 100644 index a13f3c811b7c..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_results.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_results_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_results_py3.py deleted file mode 100644 index a9265f7bcbfb..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/query_results_py3.py +++ /dev/null @@ -1,36 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/table.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/table.py deleted file mode 100644 index 699897409570..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/table.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/table_py3.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/table_py3.py deleted file mode 100644 index dc7dbe3e09b3..000000000000 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/models/table_py3.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/__init__.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/__init__.py new file mode 100644 index 000000000000..afef1f835ab6 --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/__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 ._query_operations import QueryOperations +from ._metadata_operations import MetadataOperations + +__all__ = [ + 'QueryOperations', + 'MetadataOperations', +] diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/_metadata_operations.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/_metadata_operations.py new file mode 100644 index 000000000000..86f4004afd66 --- /dev/null +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/_metadata_operations.py @@ -0,0 +1,146 @@ +# 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.pipeline import ClientRawResponse + +from .. import models + + +class MetadataOperations(object): + """MetadataOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get( + self, workspace_id, custom_headers=None, raw=False, **operation_config): + """Gets metadata information. + + Retrieve the metadata information for the workspace, including its + schema, functions, workspace info, categories etc. + + :param workspace_id: ID of the workspace. This is Workspace ID from + the Properties blade in the Azure portal. + :type workspace_id: str + :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: MetadataResults or ClientRawResponse if raw=true + :rtype: ~azure.loganalytics.models.MetadataResults or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.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['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, 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('MetadataResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/workspaces/{workspaceId}/metadata'} + + def post( + self, workspace_id, custom_headers=None, raw=False, **operation_config): + """Gets metadata information. + + Retrieve the metadata information for the workspace, including its + schema, functions, workspace info, categories etc. + + :param workspace_id: ID of the workspace. This is Workspace ID from + the Properties blade in the Azure portal. + :type workspace_id: str + :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: MetadataResults or ClientRawResponse if raw=true + :rtype: ~azure.loganalytics.models.MetadataResults or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.post.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['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, 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('MetadataResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + post.metadata = {'url': '/workspaces/{workspaceId}/metadata'} diff --git a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/log_analytics_data_client.py b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/_query_operations.py similarity index 58% rename from sdk/loganalytics/azure-loganalytics/azure/loganalytics/log_analytics_data_client.py rename to sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/_query_operations.py index 75521bb6886b..1c87807a2522 100644 --- a/sdk/loganalytics/azure-loganalytics/azure/loganalytics/log_analytics_data_client.py +++ b/sdk/loganalytics/azure-loganalytics/azure/loganalytics/operations/_query_operations.py @@ -9,64 +9,33 @@ # 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 +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)) +class QueryOperations(object): + """QueryOperations operations. - self.credentials = credentials + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - -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 + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. """ - def __init__( - self, credentials, base_url=None): + models = models - self.config = LogAnalyticsDataClientConfiguration(credentials, base_url) - super(LogAnalyticsDataClient, self).__init__(self.config.credentials, self.config) + def __init__(self, client, config, serializer, deserializer): - 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) + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.config = config - def query( + def execute( self, workspace_id, body, custom_headers=None, raw=False, **operation_config): """Execute an Analytics query. @@ -93,7 +62,7 @@ def query( :class:`ErrorResponseException` """ # Construct URL - url = self.query.metadata['url'] + url = self.execute.metadata['url'] path_format_arguments = { 'workspaceId': self._serialize.url("workspace_id", workspace_id, 'str') } @@ -104,6 +73,7 @@ def query( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -112,15 +82,13 @@ def query( 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) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, 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) @@ -129,4 +97,4 @@ def query( return client_raw_response return deserialized - query.metadata = {'url': '/workspaces/{workspaceId}/query'} + execute.metadata = {'url': '/workspaces/{workspaceId}/query'}