diff --git a/sdk/operationalinsights/loganalytics/README.md b/sdk/operationalinsights/loganalytics/README.md index ab472d65d029..621b96339ed0 100644 --- a/sdk/operationalinsights/loganalytics/README.md +++ b/sdk/operationalinsights/loganalytics/README.md @@ -15,7 +15,7 @@ npm install @azure/loganalytics ### How to use -#### nodejs - Authentication, client creation and metadata get as an example written in TypeScript. +#### nodejs - Authentication, client creation and get metadata as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth @@ -35,7 +35,7 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { const client = new LogAnalyticsClient(creds, subscriptionId); const workspaceId = "testworkspaceId"; - client.get.metadata(workspaceId).then((result) => { + client.metadata.get(workspaceId).then((result) => { console.log("The result is:"); console.log(result); }); @@ -44,7 +44,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => { }); ``` -#### browser - Authentication, client creation and metadata get as an example written in JavaScript. +#### browser - Authentication, client creation and get metadata as an example written in JavaScript. ##### Install @azure/ms-rest-browserauth @@ -78,7 +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"; - client.get.metadata(workspaceId).then((result) => { + client.metadata.get(workspaceId).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { diff --git a/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts b/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts index ba44849381db..f8387c11e7c5 100644 --- a/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts +++ b/sdk/operationalinsights/loganalytics/src/logAnalyticsClient.ts @@ -17,8 +17,7 @@ import { LogAnalyticsClientContext } from "./logAnalyticsClientContext"; class LogAnalyticsClient extends LogAnalyticsClientContext { // Operation groups query: operations.Query; - get: operations.Get; - post: operations.Post; + metadata: operations.Metadata; /** * Initializes a new instance of the LogAnalyticsClient class. @@ -28,8 +27,7 @@ class LogAnalyticsClient extends LogAnalyticsClientContext { constructor(credentials: msRest.ServiceClientCredentials, options?: Models.LogAnalyticsClientOptions) { super(credentials, options); this.query = new operations.Query(this); - this.get = new operations.Get(this); - this.post = new operations.Post(this); + this.metadata = new operations.Metadata(this); } } diff --git a/sdk/operationalinsights/loganalytics/src/models/index.ts b/sdk/operationalinsights/loganalytics/src/models/index.ts index 2533fd0d6b7d..3f53f6c9dfd0 100644 --- a/sdk/operationalinsights/loganalytics/src/models/index.ts +++ b/sdk/operationalinsights/loganalytics/src/models/index.ts @@ -793,9 +793,9 @@ export type QueryExecuteResponse = QueryResults & { }; /** - * Contains response data for the metadata operation. + * Contains response data for the get operation. */ -export type GetMetadataResponse = MetadataResults & { +export type MetadataGetResponse = MetadataResults & { /** * The underlying HTTP response. */ @@ -813,9 +813,9 @@ export type GetMetadataResponse = MetadataResults & { }; /** - * Contains response data for the metadata operation. + * Contains response data for the post operation. */ -export type PostMetadataResponse = MetadataResults & { +export type MetadataPostResponse = MetadataResults & { /** * The underlying HTTP response. */ diff --git a/sdk/operationalinsights/loganalytics/src/models/getMappers.ts b/sdk/operationalinsights/loganalytics/src/models/metadataMappers.ts similarity index 100% rename from sdk/operationalinsights/loganalytics/src/models/getMappers.ts rename to sdk/operationalinsights/loganalytics/src/models/metadataMappers.ts diff --git a/sdk/operationalinsights/loganalytics/src/models/postMappers.ts b/sdk/operationalinsights/loganalytics/src/models/postMappers.ts deleted file mode 100644 index e0f51c8ef58f..000000000000 --- a/sdk/operationalinsights/loganalytics/src/models/postMappers.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - -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/operations/get.ts b/sdk/operationalinsights/loganalytics/src/operations/get.ts deleted file mode 100644 index 60d717f46a45..000000000000 --- a/sdk/operationalinsights/loganalytics/src/operations/get.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/getMappers"; -import * as Parameters from "../models/parameters"; -import { LogAnalyticsClientContext } from "../logAnalyticsClientContext"; - -/** Class representing a Get. */ -export class Get { - private readonly client: LogAnalyticsClientContext; - - /** - * Create a Get. - * @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 - */ - metadata(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 - */ - metadata(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 - */ - metadata(workspaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - metadata(workspaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - workspaceId, - options - }, - metadataOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const metadataOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - 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/index.ts b/sdk/operationalinsights/loganalytics/src/operations/index.ts index ef9493616f56..488c614d0f1b 100644 --- a/sdk/operationalinsights/loganalytics/src/operations/index.ts +++ b/sdk/operationalinsights/loganalytics/src/operations/index.ts @@ -9,5 +9,4 @@ */ export * from "./query"; -export * from "./get"; -export * from "./post"; +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..2b2546c5976f --- /dev/null +++ b/sdk/operationalinsights/loganalytics/src/operations/metadata.ts @@ -0,0 +1,130 @@ +/* + * 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. + */ + +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/post.ts b/sdk/operationalinsights/loganalytics/src/operations/post.ts deleted file mode 100644 index e5cd7319077d..000000000000 --- a/sdk/operationalinsights/loganalytics/src/operations/post.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/postMappers"; -import * as Parameters from "../models/parameters"; -import { LogAnalyticsClientContext } from "../logAnalyticsClientContext"; - -/** Class representing a Post. */ -export class Post { - private readonly client: LogAnalyticsClientContext; - - /** - * Create a Post. - * @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 - */ - metadata(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 - */ - metadata(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 - */ - metadata(workspaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - metadata(workspaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - workspaceId, - options - }, - metadataOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const metadataOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "v1/workspaces/{workspaceId}/metadata", - urlParameters: [ - Parameters.workspaceId - ], - responses: { - 200: { - bodyMapper: Mappers.MetadataResults - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -};