diff --git a/sdk/operationalinsights/loganalytics/LICENSE.txt b/sdk/operationalinsights/loganalytics/LICENSE.txt index a70e8cf66038..2d3163745319 100644 --- a/sdk/operationalinsights/loganalytics/LICENSE.txt +++ b/sdk/operationalinsights/loganalytics/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Microsoft +Copyright (c) 2021 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/operationalinsights/loganalytics/README.md b/sdk/operationalinsights/loganalytics/README.md index 208df3c1547e..771be9646cac 100644 --- a/sdk/operationalinsights/loganalytics/README.md +++ b/sdk/operationalinsights/loganalytics/README.md @@ -9,37 +9,33 @@ This package contains an isomorphic SDK for LogAnalyticsClient. ### How to Install -``` +```bash npm install @azure/loganalytics ``` ### How to use -#### nodejs - Authentication, client creation and execute query as an example written in TypeScript. +#### nodejs - client creation and get metadata as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth -``` -npm install @azure/ms-rest-nodeauth +- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. +```bash +npm install @azure/ms-rest-nodeauth@"^3.0.0" ``` ##### Sample code -```ts -import * as msRest from "@azure/ms-rest-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { LogAnalyticsClient, LogAnalyticsModels, LogAnalyticsMappers } from "@azure/loganalytics"; +While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package +```typescript +const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +const { LogAnalyticsClient } = require("@azure/loganalytics"); const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { const client = new LogAnalyticsClient(creds, subscriptionId); const workspaceId = "testworkspaceId"; - const body: LogAnalyticsModels.QueryBody = { - query: "testquery", - timespan: "testtimespan", - workspaces: ["testworkspaces"] - }; - client.query.execute(workspaceId, body).then((result) => { + client.metadata.get(workspaceId).then((result) => { console.log("The result is:"); console.log(result); }); @@ -48,11 +44,11 @@ msRestNodeAuth.interactiveLogin().then((creds) => { }); ``` -#### browser - Authentication, client creation and execute query as an example written in JavaScript. +#### browser - Authentication, client creation and get metadata as an example written in JavaScript. ##### Install @azure/ms-rest-browserauth -``` +```bash npm install @azure/ms-rest-browserauth ``` @@ -82,12 +78,7 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to } const client = new Azure.Loganalytics.LogAnalyticsClient(res.creds, subscriptionId); const workspaceId = "testworkspaceId"; - const body = { - query: "testquery", - timespan: "testtimespan", - workspaces: ["testworkspaces"] - }; - client.query.execute(workspaceId, body).then((result) => { + client.metadata.get(workspaceId).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { @@ -105,5 +96,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Foperationalinsights%2Floganalytics%2FREADME.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/operationalinsights/loganalytics/README.png) diff --git a/sdk/operationalinsights/loganalytics/package.json b/sdk/operationalinsights/loganalytics/package.json index 835261ff989e..254bd007d7d7 100644 --- a/sdk/operationalinsights/loganalytics/package.json +++ b/sdk/operationalinsights/loganalytics/package.json @@ -4,8 +4,8 @@ "description": "LogAnalyticsClient Library with typescript type definitions for node.js and browser.", "version": "0.2.0", "dependencies": { - "@azure/ms-rest-js": "^1.1.0", - "tslib": "^1.9.3" + "@azure/ms-rest-js": "^2.0.4", + "tslib": "^1.10.0" }, "keywords": [ "node", @@ -19,18 +19,19 @@ "module": "./esm/logAnalyticsClient.js", "types": "./esm/logAnalyticsClient.d.ts", "devDependencies": { - "typescript": "^3.1.1", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", - "uglify-js": "^3.4.9" + "typescript": "^3.5.3", + "rollup": "^1.18.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.6.0" }, - "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/operationalinsights/loganalytics", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/operationalinsights/loganalytics", "repository": { "type": "git", - "url": "https://github.com/azure/azure-sdk-for-js.git" + "url": "https://github.com/Azure/azure-sdk-for-js.git" }, "bugs": { - "url": "https://github.com/azure/azure-sdk-for-js/issues" + "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", @@ -42,6 +43,7 @@ "esm/**/*.d.ts", "esm/**/*.d.ts.map", "src/**/*.ts", + "README.md", "rollup.config.js", "tsconfig.json" ], diff --git a/sdk/operationalinsights/loganalytics/rollup.config.js b/sdk/operationalinsights/loganalytics/rollup.config.js index a25a9cc464b5..9773ebaf28db 100644 --- a/sdk/operationalinsights/loganalytics/rollup.config.js +++ b/sdk/operationalinsights/loganalytics/rollup.config.js @@ -1,10 +1,16 @@ +import rollup from "rollup"; import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + /** - * @type {import('rollup').RollupFileOptions} + * @type {rollup.RollupFileOptions} */ const config = { - input: './esm/logAnalyticsClient.js', - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], + input: "./esm/logAnalyticsClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], output: { file: "./dist/loganalytics.js", format: "umd", @@ -15,17 +21,17 @@ const config = { "@azure/ms-rest-azure-js": "msRestAzure" }, banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */` }, plugins: [ - nodeResolve({ module: true }) + nodeResolve({ mainFields: ['module', 'main'] }), + sourcemaps() ] }; + export default config; diff --git a/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts b/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts index da6795a42df5..a785995392d2 100644 --- a/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts +++ b/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is @@ -17,6 +16,7 @@ import { LogAnalyticsClientContext } from "./logAnalyticsClientContext"; class LogAnalyticsClient extends LogAnalyticsClientContext { // Operation groups query: operations.Query; + metadata: operations.Metadata; /** * Initializes a new instance of the LogAnalyticsClient class. @@ -26,6 +26,7 @@ class LogAnalyticsClient extends LogAnalyticsClientContext { constructor(credentials: msRest.ServiceClientCredentials, options?: Models.LogAnalyticsClientOptions) { super(credentials, options); this.query = new operations.Query(this); + this.metadata = new operations.Metadata(this); } } diff --git a/sdk/operationalinsights/loganalytics/src/logAnalyticsClientContext.ts b/sdk/operationalinsights/loganalytics/src/logAnalyticsClientContext.ts index ff55138f8c26..a511c8824476 100644 --- a/sdk/operationalinsights/loganalytics/src/logAnalyticsClientContext.ts +++ b/sdk/operationalinsights/loganalytics/src/logAnalyticsClientContext.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is @@ -12,7 +11,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as Models from "./models"; const packageName = "@azure/loganalytics"; -const packageVersion = "0.1.0"; +const packageVersion = "0.2.0"; export class LogAnalyticsClientContext extends msRest.ServiceClient { credentials: msRest.ServiceClientCredentials; @@ -23,23 +22,23 @@ export class LogAnalyticsClientContext extends msRest.ServiceClient { * @param [options] The parameter options */ constructor(credentials: msRest.ServiceClientCredentials, options?: Models.LogAnalyticsClientOptions) { - if (credentials === null || credentials === undefined) { - throw new Error('\'credentials\' cannot be null.'); + if (credentials == undefined) { + throw new Error("'credentials' cannot be null."); } if (!options) { options = {}; } - if(!options.userAgent) { + + if (!options.userAgent) { const defaultUserAgent = msRest.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } super(credentials, options); - this.baseUri = options.baseUri || this.baseUri || "https://api.loganalytics.io"; + this.baseUri = options.baseUri || this.baseUri || "https://api.loganalytics.io/v1"; this.requestContentType = "application/json; charset=utf-8"; this.credentials = credentials; - } } diff --git a/sdk/operationalinsights/loganalytics/src/models/index.ts b/sdk/operationalinsights/loganalytics/src/models/index.ts index 52da54ffbedb..89341f6403e6 100644 --- a/sdk/operationalinsights/loganalytics/src/models/index.ts +++ b/sdk/operationalinsights/loganalytics/src/models/index.ts @@ -1,191 +1,777 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { ServiceClientOptions } from "@azure/ms-rest-js"; import * as msRest from "@azure/ms-rest-js"; - /** - * @interface - * An interface representing QueryBody. * The Analytics query. Learn more about the [Analytics query * syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) - * */ export interface QueryBody { /** - * @member {string} query The query to execute. + * The query to execute. */ query: string; /** - * @member {string} [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. + * 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. */ timespan?: string; /** - * @member {string[]} [workspaces] A list of workspaces that are included in - * the query. + * A list of workspaces that are included in the query. */ workspaces?: string[]; } /** - * @interface - * An interface representing Column. - * @summary A table column. - * * A column in a table. - * + * @summary A table column. */ export interface Column { /** - * @member {string} [name] The name of this column. + * The name of this column. */ name?: string; /** - * @member {string} [type] The data type of this column. + * The data type of this column. */ type?: string; } /** - * @interface - * An interface representing Table. - * @summary A query response table. - * * Contains the columns and rows for one table in a query response. - * + * @summary A query response table. */ export interface Table { /** - * @member {string} name The name of the table. + * The name of the table. */ name: string; /** - * @member {Column[]} columns The list of columns in this table. + * The list of columns in this table. */ columns: Column[]; /** - * @member {string[][]} rows The resulting rows from this query. + * The resulting rows from this query. */ rows: string[][]; } /** - * @interface - * An interface representing QueryResults. - * @summary A query response. - * * Contains the tables, columns & rows resulting from a query. - * + * @summary A query response. */ export interface QueryResults { /** - * @member {Table[]} tables The list of tables, columns and rows. + * The list of tables, columns and rows. */ tables: Table[]; } /** - * @interface + * The related metadata items for the category + */ +export interface MetadataCategoryRelated { + /** + * The tables related to the category + */ + tables?: string[]; + /** + * The functions related to the category + */ + functions?: string[]; + /** + * The resource types related to the category + */ + resourceTypes?: string[]; + /** + * The saved queries related to the category + */ + queries?: string[]; + /** + * The Log Analytics solutions related to the category + */ + solutions?: string[]; +} + +/** + * Categories are used to group other metadata entities. + * @summary A metadata category. + */ +export interface MetadataCategory { + /** + * The ID of the category + */ + id: string; + /** + * The display name of the category + */ + displayName: string; + /** + * The description of the category + */ + description?: string; + /** + * The related metadata items for the category + */ + related?: MetadataCategoryRelated; +} + +/** + * The related metadata items for the resource-type + */ +export interface MetadataResourceTypeRelated { + /** + * The tables related to the resource-type + */ + tables?: string[]; + /** + * The functions related to the resource-type + */ + functions?: string[]; + /** + * The categories related to the resource-type + */ + categories?: string[]; + /** + * The queries related to the resource-type + */ + queries?: string[]; + /** + * The Log Analytics workspaces related to the resource-type + */ + workspaces?: string[]; + /** + * The Azure resources related to the resource-type + */ + resources?: string[]; +} + +/** + * Metadata about types of Azure resources, containing relevant tables, functions, etc. + * @summary A type of resource in Azure. + */ +export interface MetadataResourceType { + /** + * The ID of the resource-type + */ + id: string; + /** + * The type of the resource-type + */ + type: string; + /** + * The display name of the resource-type + */ + displayName?: string; + /** + * The description of the resource-type + */ + description?: string; + /** + * The user-defined labels of the resource-type + */ + labels?: string[]; + /** + * The tags associated with the resource-type + */ + tags?: any; + /** + * The properties of the resource-type + */ + properties?: any; + /** + * The related metadata items for the resource-type + */ + related?: MetadataResourceTypeRelated; +} + +/** + * The related metadata items for the Log Analytics solution + */ +export interface MetadataSolutionRelated { + /** + * The tables related to the Log Analytics solution + */ + tables: string[]; + /** + * The functions related to the Log Analytics solution + */ + functions?: string[]; + /** + * The categories related to the Log Analytics solution + */ + categories?: string[]; + /** + * The saved queries related to the Log Analytics solution + */ + queries?: string[]; + /** + * The Workspaces referenced in the metadata request that are related to the Log Analytics + * solution + */ + workspaces?: string[]; +} + +/** + * Solutions can group tables and functions that are associated with a certain Azure Log Analytics + * offering. + * @summary A Log Analytics solution. + */ +export interface MetadataSolution { + /** + * The ID of the Log Analytics solution + */ + id: string; + /** + * The name of the Log Analytics solution + */ + name: string; + /** + * The display name of the Log Analytics solution + */ + displayName?: string; + /** + * The description of the Log Analytics solution + */ + description?: string; + /** + * The tags that are associated with the Log Analytics solution + */ + tags?: any; + /** + * The properties of the Log Analytics solution + */ + properties?: any; + /** + * The related metadata items for the Log Analytics solution + */ + related: MetadataSolutionRelated; +} + +/** + * An interface representing MetadataTableColumnsItem. + */ +export interface MetadataTableColumnsItem { + /** + * The name of the column + */ + name: string; + /** + * The description of the column + */ + description?: string; + /** + * The data type of the column. Possible values include: 'bool', 'datetime', 'dynamic', 'int', + * 'long', 'real', 'string' + */ + type: MetadataColumnDataType; + /** + * A flag indicating this column is a preferred facet + */ + isPreferredFacet?: boolean; + /** + * an indication of the source of the column, used only when multiple workspaces have conflicting + * definition for the column + */ + source?: any; +} + +/** + * The related metadata items for the table + */ +export interface MetadataTableRelated { + /** + * The related categories for the table + */ + categories?: string[]; + /** + * The related Log Analytics solutions for the table + */ + solutions?: string[]; + /** + * The related resource types for the table + */ + resourceTypes?: string[]; + /** + * The related Log Analytics workspaces for the table + */ + workspaces?: string[]; + /** + * The related functions for the table + */ + functions?: string[]; + /** + * The related saved queries for the table + */ + queries?: string[]; +} + +/** + * Tables are part of the workspace schema, and contain a list of columns and a reference to other + * relevant metadata items. + * @summary A data table that takes part in a workspace schema. + */ +export interface MetadataTable { + /** + * The ID of the table + */ + id: string; + /** + * The name of the table + */ + name: string; + /** + * The description of the table + */ + description?: string; + /** + * The column associated with the timespan query parameter for the table + */ + timespanColumn?: string; + /** + * The user defined labels of the table + */ + labels?: string[]; + /** + * The tags associated with the table + */ + tags?: any; + /** + * The properties of the table + */ + properties?: any; + /** + * The list of columns defined on the table + */ + columns?: MetadataTableColumnsItem[]; + /** + * The related metadata items for the table + */ + related?: MetadataTableRelated; +} + +/** + * The related metadata items for the function. + */ +export interface MetadataFunctionRelated { + /** + * The related tables for the function. + */ + tables?: string[]; + /** + * The related Log Analytics solutions for the function. + */ + solutions?: string[]; + /** + * The related resource types for the function. + */ + resourceTypes?: string[]; + /** + * The related categories for the function. + */ + categories?: string[]; + /** + * The related workspaces for the function. + */ + workspaces?: string[]; +} + +/** + * Functions are stored Kusto queries that can be specified as part of queries by using their name. + * @summary A stored function. + */ +export interface MetadataFunction { + /** + * The ID of the function. + */ + id: string; + /** + * The name of the function, to be used in queries. + */ + name: string; + /** + * The parameters/arguments of the function, if any. + */ + parameters?: string; + /** + * The display name of the function. + */ + displayName?: string; + /** + * The description of the function. + */ + description?: string; + /** + * The KQL body of the function. + */ + body: string; + /** + * The tags associated with the function. + */ + tags?: any; + /** + * The properties of the function. + */ + properties?: any; + /** + * The related metadata items for the function. + */ + related?: MetadataFunctionRelated; +} + +/** + * The related metadata items for the query. + */ +export interface MetadataQueryRelated { + /** + * The related categories for the query. + */ + categories?: string[]; + /** + * The related Log Analytics solutions for the query. + */ + solutions?: string[]; + /** + * The related resource types for the query. + */ + resourceTypes?: string[]; + /** + * The related tables for the query. + */ + tables?: string[]; +} + +/** + * Queries are stored pieces of KQL, along with a list of relevant metadata items. + * @summary A stored query. + */ +export interface MetadataQuery { + /** + * The ID of the query. + */ + id: string; + /** + * The display name of the query. + */ + displayName?: string; + /** + * The description of the query. + */ + description?: string; + /** + * The KQL body of the query. + */ + body: string; + /** + * The user defined labels associated with the query. + */ + labels?: string[]; + /** + * The tags associated with the query. + */ + tags?: any; + /** + * The properties of the query. + */ + properties?: any; + /** + * The related metadata items for the query. + */ + related?: MetadataQueryRelated; +} + +/** + * The related metadata items for the Application Insights app. + */ +export interface MetadataApplicationRelated { + /** + * The related tables for the Application Insights app. + */ + tables?: string[]; + /** + * The related functions for the Application Insights app. + */ + functions?: string[]; +} + +/** + * Application Insights apps that were part of the metadata request and that the user has access + * to. + * @summary An Application Insights application. + */ +export interface MetadataApplication { + /** + * The ID of the Application Insights app. + */ + id: string; + /** + * The ARM resource ID of the Application Insights app. + */ + resourceId: string; + /** + * The name of the Application Insights app. + */ + name: string; + /** + * The Azure region of the Application Insights app. + */ + region: string; + /** + * The related metadata items for the Application Insights app. + */ + related?: MetadataApplicationRelated; +} + +/** + * The related metadata items for the Log Analytics workspace. + */ +export interface MetadataWorkspaceRelated { + /** + * The related tables for the Log Analytics workspace. + */ + tables?: string[]; + /** + * The related Log Analytics solutions for the Log Analytics workspace. + */ + solutions?: string[]; + /** + * The related resource types for the Log Analytics workspace. + */ + resourceTypes?: string[]; + /** + * The related functions for the Log Analytics workspace. + */ + functions?: string[]; + /** + * The related Azure resources for the Log Analytics workspace. + */ + resources?: string[]; +} + +/** + * Log Analytics workspaces that were part of the metadata request and that the user has access to. + * @summary A Log Analytics workspace. + */ +export interface MetadataWorkspace { + /** + * The ID of the Log Analytics workspace. + */ + id: string; + /** + * The ARM resource ID of the Log Analytics workspace. + */ + resourceId: string; + /** + * The name of the Log Analytics workspace. + */ + name: string; + /** + * The Azure region of the Log Analytics workspace. + */ + region: string; + /** + * The related metadata items for the Log Analytics workspace. + */ + related?: MetadataWorkspaceRelated; +} + +/** + * An interface representing MetadataPermissionsWorkspacesItem. + */ +export interface MetadataPermissionsWorkspacesItem { + /** + * The resource ID on the permission indication. + */ + resourceId: string; + /** + * The list of tables that were denied access for the resource ID. + */ + denyTables?: string[]; +} + +/** + * An interface representing MetadataPermissionsResourcesItem. + */ +export interface MetadataPermissionsResourcesItem { + /** + * The resource ID on the permission indication. + */ + resourceId: string; + /** + * The list of tables that were denied access for the resource ID. + */ + denyTables?: string[]; +} + +/** + * An interface representing MetadataPermissionsApplicationsItem. + */ +export interface MetadataPermissionsApplicationsItem { + /** + * The resource ID on the permission indication. + */ + resourceId: string; +} + +/** + * Permission information for the metadata call, includes apps/workspaces/resource the user didn't + * have access to. + * @summary Permission information. + */ +export interface MetadataPermissions { + /** + * The permission indication for the workspaces on the metadata request. + */ + workspaces: MetadataPermissionsWorkspacesItem[]; + /** + * The permission indication for the Azure resources on the metadata request. + */ + resources?: MetadataPermissionsResourcesItem[]; + /** + * The permission indication for the Application Insights apps on the metadata request. + */ + applications?: MetadataPermissionsApplicationsItem[]; +} + +/** + * The metadata response for the app, including available tables, etc. + * @summary A metadata response. + */ +export interface MetadataResults { + /** + * The list of categories that are referenced in this metadata response. + */ + categories?: MetadataCategory[]; + /** + * The list of resource types that are referenced in this metadata response. + */ + resourceTypes?: MetadataResourceType[]; + /** + * The list of Log Analytics solutions installed on the workspace. + */ + solutions?: MetadataSolution[]; + /** + * The list of tables and columns that comprise the schema of the workspace. + */ + tables?: MetadataTable[]; + /** + * The list of functions stored on the workspace, or introduced by solutions etc. + */ + functions?: MetadataFunction[]; + /** + * The list of saved queries stored on the workspace, or introduced by solutions, resource types, + * etc. + */ + queries?: MetadataQuery[]; + /** + * The list of Application Insights apps that were referenced in the metadata request. + */ + applications?: MetadataApplication[]; + /** + * The list of Log Analytics workspaces that were referenced in the metadata request. + */ + workspaces?: MetadataWorkspace[]; + /** + * The list of Azure resources that were referenced in the metadata request. + */ + resources?: any[]; + /** + * The list of permission rules that affected the metadata request. + */ + permissions?: MetadataPermissions[]; +} + +/** * An interface representing ErrorDetail. * @summary Error details. - * */ export interface ErrorDetail { /** - * @member {string} code The error's code. + * The error's code. */ code: string; /** - * @member {string} message A human readable error message. + * A human readable error message. */ message: string; /** - * @member {string} [target] Indicates which property in the request is - * responsible for the error. + * Indicates which property in the request is responsible for the error. */ target?: string; /** - * @member {string} [value] Indicates which value in 'target' is responsible - * for the error. + * Indicates which value in 'target' is responsible for the error. */ value?: string; /** - * @member {string[]} [resources] Indicates resources which were responsible - * for the error. + * Indicates resources which were responsible for the error. */ resources?: string[]; /** - * @member {any} [additionalProperties] + * Additional properties that can be provided on the error details object */ additionalProperties?: any; } /** - * @interface * An interface representing ErrorInfo. * @summary The code and message for an error. - * */ export interface ErrorInfo { /** - * @member {string} code A machine readable error code. + * A machine readable error code. */ code: string; /** - * @member {string} message A human readable error message. + * A human readable error message. */ message: string; /** - * @member {ErrorDetail[]} [details] error details. + * error details. */ details?: ErrorDetail[]; /** - * @member {ErrorInfo} [innererror] Inner error details if they exist. + * Inner error details if they exist. */ innererror?: ErrorInfo; /** - * @member {any} [additionalProperties] + * Additional properties that can be provided on the error info object */ additionalProperties?: any; } /** - * @interface - * An interface representing ErrorResponse. - * @summary Error details. - * * Contains details when the response code indicates an error. - * + * @summary Error details. */ export interface ErrorResponse { /** - * @member {ErrorInfo} error The error details. + * The error details. */ error: ErrorInfo; } /** - * @interface * An interface representing LogAnalyticsClientOptions. - * @extends ServiceClientOptions */ export interface LogAnalyticsClientOptions extends ServiceClientOptions { - /** - * @member {string} [baseUri] - */ baseUri?: string; } +/** + * Defines values for MetadataColumnDataType. + * Possible values include: 'bool', 'datetime', 'dynamic', 'int', 'long', 'real', 'string' + * @readonly + * @enum {string} + */ +export type MetadataColumnDataType = 'bool' | 'datetime' | 'dynamic' | 'int' | 'long' | 'real' | 'string'; + /** * Contains response data for the execute operation. */ @@ -198,9 +784,50 @@ export type QueryExecuteResponse = QueryResults & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ parsedBody: QueryResults; }; }; + +/** + * Contains response data for the get operation. + */ +export type MetadataGetResponse = MetadataResults & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetadataResults; + }; +}; + +/** + * Contains response data for the post operation. + */ +export type MetadataPostResponse = MetadataResults & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetadataResults; + }; +}; diff --git a/sdk/operationalinsights/loganalytics/src/models/mappers.ts b/sdk/operationalinsights/loganalytics/src/models/mappers.ts index cd3f848e53c8..945045c85b80 100644 --- a/sdk/operationalinsights/loganalytics/src/models/mappers.ts +++ b/sdk/operationalinsights/loganalytics/src/models/mappers.ts @@ -1,11 +1,9 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import * as msRest from "@azure/ms-rest-js"; @@ -137,6 +135,1287 @@ export const QueryResults: msRest.CompositeMapper = { } }; +export const MetadataCategoryRelated: msRest.CompositeMapper = { + serializedName: "metadataCategory_related", + type: { + name: "Composite", + className: "MetadataCategoryRelated", + modelProperties: { + tables: { + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + functions: { + serializedName: "functions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceTypes: { + serializedName: "resourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + queries: { + serializedName: "queries", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + solutions: { + serializedName: "solutions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataCategory: msRest.CompositeMapper = { + serializedName: "metadataCategory", + type: { + name: "Composite", + className: "MetadataCategory", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + displayName: { + required: true, + serializedName: "displayName", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + related: { + serializedName: "related", + type: { + name: "Composite", + className: "MetadataCategoryRelated" + } + } + } + } +}; + +export const MetadataResourceTypeRelated: msRest.CompositeMapper = { + serializedName: "metadataResourceType_related", + type: { + name: "Composite", + className: "MetadataResourceTypeRelated", + modelProperties: { + tables: { + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + functions: { + serializedName: "functions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + categories: { + serializedName: "categories", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + queries: { + serializedName: "queries", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + workspaces: { + serializedName: "workspaces", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resources: { + serializedName: "resources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataResourceType: msRest.CompositeMapper = { + serializedName: "metadataResourceType", + type: { + name: "Composite", + className: "MetadataResourceType", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + labels: { + serializedName: "labels", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + tags: { + serializedName: "tags", + type: { + name: "Object" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + }, + related: { + serializedName: "related", + type: { + name: "Composite", + className: "MetadataResourceTypeRelated" + } + } + } + } +}; + +export const MetadataSolutionRelated: msRest.CompositeMapper = { + serializedName: "metadataSolution_related", + type: { + name: "Composite", + className: "MetadataSolutionRelated", + modelProperties: { + tables: { + required: true, + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + functions: { + serializedName: "functions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + categories: { + serializedName: "categories", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + queries: { + serializedName: "queries", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + workspaces: { + serializedName: "workspaces", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataSolution: msRest.CompositeMapper = { + serializedName: "metadataSolution", + type: { + name: "Composite", + className: "MetadataSolution", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Object" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + }, + related: { + required: true, + serializedName: "related", + type: { + name: "Composite", + className: "MetadataSolutionRelated" + } + } + } + } +}; + +export const MetadataTableColumnsItem: msRest.CompositeMapper = { + serializedName: "metadataTable_columnsItem", + type: { + name: "Composite", + className: "MetadataTableColumnsItem", + modelProperties: { + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + }, + isPreferredFacet: { + serializedName: "isPreferredFacet", + type: { + name: "Boolean" + } + }, + source: { + serializedName: "source", + type: { + name: "Object" + } + } + } + } +}; + +export const MetadataTableRelated: msRest.CompositeMapper = { + serializedName: "metadataTable_related", + type: { + name: "Composite", + className: "MetadataTableRelated", + modelProperties: { + categories: { + serializedName: "categories", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + solutions: { + serializedName: "solutions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceTypes: { + serializedName: "resourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + workspaces: { + serializedName: "workspaces", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + functions: { + serializedName: "functions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + queries: { + serializedName: "queries", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataTable: msRest.CompositeMapper = { + serializedName: "metadataTable", + type: { + name: "Composite", + className: "MetadataTable", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + timespanColumn: { + serializedName: "timespanColumn", + type: { + name: "String" + } + }, + labels: { + serializedName: "labels", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + tags: { + serializedName: "tags", + type: { + name: "Object" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + }, + columns: { + serializedName: "columns", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataTableColumnsItem" + } + } + } + }, + related: { + serializedName: "related", + type: { + name: "Composite", + className: "MetadataTableRelated" + } + } + } + } +}; + +export const MetadataFunctionRelated: msRest.CompositeMapper = { + serializedName: "metadataFunction_related", + type: { + name: "Composite", + className: "MetadataFunctionRelated", + modelProperties: { + tables: { + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + solutions: { + serializedName: "solutions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceTypes: { + serializedName: "resourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + categories: { + serializedName: "categories", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + workspaces: { + serializedName: "workspaces", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataFunction: msRest.CompositeMapper = { + serializedName: "metadataFunction", + type: { + name: "Composite", + className: "MetadataFunction", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + parameters: { + serializedName: "parameters", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + body: { + required: true, + serializedName: "body", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Object" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + }, + related: { + serializedName: "related", + type: { + name: "Composite", + className: "MetadataFunctionRelated" + } + } + } + } +}; + +export const MetadataQueryRelated: msRest.CompositeMapper = { + serializedName: "metadataQuery_related", + type: { + name: "Composite", + className: "MetadataQueryRelated", + modelProperties: { + categories: { + serializedName: "categories", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + solutions: { + serializedName: "solutions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceTypes: { + serializedName: "resourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + tables: { + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataQuery: msRest.CompositeMapper = { + serializedName: "metadataQuery", + type: { + name: "Composite", + className: "MetadataQuery", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + body: { + required: true, + serializedName: "body", + type: { + name: "String" + } + }, + labels: { + serializedName: "labels", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + tags: { + serializedName: "tags", + type: { + name: "Object" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Object" + } + }, + related: { + serializedName: "related", + type: { + name: "Composite", + className: "MetadataQueryRelated" + } + } + } + } +}; + +export const MetadataApplicationRelated: msRest.CompositeMapper = { + serializedName: "metadataApplication_related", + type: { + name: "Composite", + className: "MetadataApplicationRelated", + modelProperties: { + tables: { + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + functions: { + serializedName: "functions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataApplication: msRest.CompositeMapper = { + serializedName: "metadataApplication", + type: { + name: "Composite", + className: "MetadataApplication", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + resourceId: { + required: true, + serializedName: "resourceId", + type: { + name: "String" + } + }, + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + region: { + required: true, + serializedName: "region", + type: { + name: "String" + } + }, + related: { + serializedName: "related", + type: { + name: "Composite", + className: "MetadataApplicationRelated" + } + } + } + } +}; + +export const MetadataWorkspaceRelated: msRest.CompositeMapper = { + serializedName: "metadataWorkspace_related", + type: { + name: "Composite", + className: "MetadataWorkspaceRelated", + modelProperties: { + tables: { + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + solutions: { + serializedName: "solutions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceTypes: { + serializedName: "resourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + functions: { + serializedName: "functions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resources: { + serializedName: "resources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataWorkspace: msRest.CompositeMapper = { + serializedName: "metadataWorkspace", + type: { + name: "Composite", + className: "MetadataWorkspace", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + resourceId: { + required: true, + serializedName: "resourceId", + type: { + name: "String" + } + }, + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + region: { + required: true, + serializedName: "region", + type: { + name: "String" + } + }, + related: { + serializedName: "related", + type: { + name: "Composite", + className: "MetadataWorkspaceRelated" + } + } + } + } +}; + +export const MetadataPermissionsWorkspacesItem: msRest.CompositeMapper = { + serializedName: "metadataPermissions_workspacesItem", + type: { + name: "Composite", + className: "MetadataPermissionsWorkspacesItem", + modelProperties: { + resourceId: { + required: true, + serializedName: "resourceId", + type: { + name: "String" + } + }, + denyTables: { + serializedName: "denyTables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataPermissionsResourcesItem: msRest.CompositeMapper = { + serializedName: "metadataPermissions_resourcesItem", + type: { + name: "Composite", + className: "MetadataPermissionsResourcesItem", + modelProperties: { + resourceId: { + required: true, + serializedName: "resourceId", + type: { + name: "String" + } + }, + denyTables: { + serializedName: "denyTables", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const MetadataPermissionsApplicationsItem: msRest.CompositeMapper = { + serializedName: "metadataPermissions_applicationsItem", + type: { + name: "Composite", + className: "MetadataPermissionsApplicationsItem", + modelProperties: { + resourceId: { + required: true, + serializedName: "resourceId", + type: { + name: "String" + } + } + } + } +}; + +export const MetadataPermissions: msRest.CompositeMapper = { + serializedName: "metadataPermissions", + type: { + name: "Composite", + className: "MetadataPermissions", + modelProperties: { + workspaces: { + required: true, + serializedName: "workspaces", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataPermissionsWorkspacesItem" + } + } + } + }, + resources: { + serializedName: "resources", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataPermissionsResourcesItem" + } + } + } + }, + applications: { + serializedName: "applications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataPermissionsApplicationsItem" + } + } + } + } + } + } +}; + +export const MetadataResults: msRest.CompositeMapper = { + serializedName: "metadataResults", + type: { + name: "Composite", + className: "MetadataResults", + modelProperties: { + categories: { + serializedName: "categories", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataCategory" + } + } + } + }, + resourceTypes: { + serializedName: "resourceTypes", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataResourceType" + } + } + } + }, + solutions: { + serializedName: "solutions", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataSolution" + } + } + } + }, + tables: { + serializedName: "tables", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataTable" + } + } + } + }, + functions: { + serializedName: "functions", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataFunction" + } + } + } + }, + queries: { + serializedName: "queries", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataQuery" + } + } + } + }, + applications: { + serializedName: "applications", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataApplication" + } + } + } + }, + workspaces: { + serializedName: "workspaces", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataWorkspace" + } + } + } + }, + resources: { + serializedName: "resources", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Object" + } + } + } + }, + permissions: { + serializedName: "permissions", + constraints: { + UniqueItems: true + }, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataPermissions" + } + } + } + } + } + } +}; + export const ErrorDetail: msRest.CompositeMapper = { serializedName: "errorDetail", type: { diff --git a/sdk/operationalinsights/loganalytics/src/models/metadataMappers.ts b/sdk/operationalinsights/loganalytics/src/models/metadataMappers.ts new file mode 100644 index 000000000000..6a72625f3bbd --- /dev/null +++ b/sdk/operationalinsights/loganalytics/src/models/metadataMappers.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + ErrorDetail, + ErrorInfo, + ErrorResponse, + MetadataApplication, + MetadataApplicationRelated, + MetadataCategory, + MetadataCategoryRelated, + MetadataFunction, + MetadataFunctionRelated, + MetadataPermissions, + MetadataPermissionsApplicationsItem, + MetadataPermissionsResourcesItem, + MetadataPermissionsWorkspacesItem, + MetadataQuery, + MetadataQueryRelated, + MetadataResourceType, + MetadataResourceTypeRelated, + MetadataResults, + MetadataSolution, + MetadataSolutionRelated, + MetadataTable, + MetadataTableColumnsItem, + MetadataTableRelated, + MetadataWorkspace, + MetadataWorkspaceRelated +} from "../models/mappers"; diff --git a/sdk/operationalinsights/loganalytics/src/models/parameters.ts b/sdk/operationalinsights/loganalytics/src/models/parameters.ts index 4a414cdb76f6..60323f21ebf4 100644 --- a/sdk/operationalinsights/loganalytics/src/models/parameters.ts +++ b/sdk/operationalinsights/loganalytics/src/models/parameters.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is diff --git a/sdk/operationalinsights/loganalytics/src/models/queryMappers.ts b/sdk/operationalinsights/loganalytics/src/models/queryMappers.ts index 6add1a2ffa64..4a9fff657a0f 100644 --- a/sdk/operationalinsights/loganalytics/src/models/queryMappers.ts +++ b/sdk/operationalinsights/loganalytics/src/models/queryMappers.ts @@ -1,20 +1,17 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export { - QueryBody, - QueryResults, - Table, Column, - ErrorResponse, + ErrorDetail, ErrorInfo, - ErrorDetail + ErrorResponse, + QueryBody, + QueryResults, + Table } from "../models/mappers"; - diff --git a/sdk/operationalinsights/loganalytics/src/operations/index.ts b/sdk/operationalinsights/loganalytics/src/operations/index.ts index 3c190e0c93b3..428395e6bdbb 100644 --- a/sdk/operationalinsights/loganalytics/src/operations/index.ts +++ b/sdk/operationalinsights/loganalytics/src/operations/index.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is @@ -9,3 +8,4 @@ */ export * from "./query"; +export * from "./metadata"; diff --git a/sdk/operationalinsights/loganalytics/src/operations/metadata.ts b/sdk/operationalinsights/loganalytics/src/operations/metadata.ts new file mode 100644 index 000000000000..b991888b1d79 --- /dev/null +++ b/sdk/operationalinsights/loganalytics/src/operations/metadata.ts @@ -0,0 +1,129 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/metadataMappers"; +import * as Parameters from "../models/parameters"; +import { LogAnalyticsClientContext } from "../logAnalyticsClientContext"; + +/** Class representing a Metadata. */ +export class Metadata { + private readonly client: LogAnalyticsClientContext; + + /** + * Create a Metadata. + * @param {LogAnalyticsClientContext} client Reference to the service client. + */ + constructor(client: LogAnalyticsClientContext) { + this.client = client; + } + + /** + * Retrieve the metadata information for the workspace, including its schema, functions, workspace + * info, categories etc. + * @summary Gets metadata information + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the + * Azure portal. + * @param [options] The optional parameters + * @returns Promise + */ + get(workspaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the + * Azure portal. + * @param callback The callback + */ + get(workspaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the + * Azure portal. + * @param options The optional parameters + * @param callback The callback + */ + get(workspaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(workspaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + workspaceId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Retrieve the metadata information for the workspace, including its schema, functions, workspace + * info, categories etc. + * @summary Gets metadata information + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the + * Azure portal. + * @param [options] The optional parameters + * @returns Promise + */ + post(workspaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the + * Azure portal. + * @param callback The callback + */ + post(workspaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the + * Azure portal. + * @param options The optional parameters + * @param callback The callback + */ + post(workspaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + post(workspaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + workspaceId, + options + }, + postOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "v1/workspaces/{workspaceId}/metadata", + urlParameters: [ + Parameters.workspaceId + ], + responses: { + 200: { + bodyMapper: Mappers.MetadataResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const postOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "v1/workspaces/{workspaceId}/metadata", + urlParameters: [ + Parameters.workspaceId + ], + responses: { + 200: { + bodyMapper: Mappers.MetadataResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/operationalinsights/loganalytics/src/operations/query.ts b/sdk/operationalinsights/loganalytics/src/operations/query.ts index 9fe30ac699db..3608a710e388 100644 --- a/sdk/operationalinsights/loganalytics/src/operations/query.ts +++ b/sdk/operationalinsights/loganalytics/src/operations/query.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is diff --git a/sdk/operationalinsights/loganalytics/tsconfig.json b/sdk/operationalinsights/loganalytics/tsconfig.json index 87bbf5b5fa49..422b584abd5e 100644 --- a/sdk/operationalinsights/loganalytics/tsconfig.json +++ b/sdk/operationalinsights/loganalytics/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "lib": ["es6", "dom"], "declaration": true, "outDir": "./esm", "importHelpers": true