/* * 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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { setContinuationToken } from "../pagingHelper"; import { Labs } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { DevTestLabsClient } from "../devTestLabsClient"; import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; import { LroImpl } from "../lroImpl"; import { Lab, LabsListBySubscriptionNextOptionalParams, LabsListBySubscriptionOptionalParams, LabsListBySubscriptionResponse, LabsListByResourceGroupNextOptionalParams, LabsListByResourceGroupOptionalParams, LabsListByResourceGroupResponse, LabVhd, LabsListVhdsNextOptionalParams, LabsListVhdsOptionalParams, LabsListVhdsResponse, LabsGetOptionalParams, LabsGetResponse, LabsCreateOrUpdateOptionalParams, LabsCreateOrUpdateResponse, LabsDeleteOptionalParams, LabFragment, LabsUpdateOptionalParams, LabsUpdateResponse, LabsClaimAnyVmOptionalParams, LabVirtualMachineCreationParameter, LabsCreateEnvironmentOptionalParams, ExportResourceUsageParameters, LabsExportResourceUsageOptionalParams, GenerateUploadUriParameter, LabsGenerateUploadUriOptionalParams, LabsGenerateUploadUriResponse, ImportLabVirtualMachineRequest, LabsImportVirtualMachineOptionalParams, LabsListBySubscriptionNextResponse, LabsListByResourceGroupNextResponse, LabsListVhdsNextResponse } from "../models"; /// /** Class containing Labs operations. */ export class LabsImpl implements Labs { private readonly client: DevTestLabsClient; /** * Initialize a new instance of the class Labs class. * @param client Reference to the service client */ constructor(client: DevTestLabsClient) { this.client = client; } /** * List labs in a subscription. * @param options The options parameters. */ public listBySubscription( options?: LabsListBySubscriptionOptionalParams ): PagedAsyncIterableIterator { const iter = this.listBySubscriptionPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings?: PageSettings) => { if (settings?.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( options?: LabsListBySubscriptionOptionalParams, settings?: PageSettings ): AsyncIterableIterator { let result: LabsListBySubscriptionResponse; let continuationToken = settings?.continuationToken; if (!continuationToken) { result = await this._listBySubscription(options); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield page; } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield page; } } private async *listBySubscriptionPagingAll( options?: LabsListBySubscriptionOptionalParams ): AsyncIterableIterator { for await (const page of this.listBySubscriptionPagingPage(options)) { yield* page; } } /** * List labs in a resource group. * @param resourceGroupName The name of the resource group. * @param options The options parameters. */ public listByResourceGroup( resourceGroupName: string, options?: LabsListByResourceGroupOptionalParams ): PagedAsyncIterableIterator { const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings?: PageSettings) => { if (settings?.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listByResourceGroupPagingPage( resourceGroupName, options, settings ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, options?: LabsListByResourceGroupOptionalParams, settings?: PageSettings ): AsyncIterableIterator { let result: LabsListByResourceGroupResponse; let continuationToken = settings?.continuationToken; if (!continuationToken) { result = await this._listByResourceGroup(resourceGroupName, options); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield page; } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, continuationToken, options ); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield page; } } private async *listByResourceGroupPagingAll( resourceGroupName: string, options?: LabsListByResourceGroupOptionalParams ): AsyncIterableIterator { for await (const page of this.listByResourceGroupPagingPage( resourceGroupName, options )) { yield* page; } } /** * List disk images available for custom image creation. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param options The options parameters. */ public listVhds( resourceGroupName: string, name: string, options?: LabsListVhdsOptionalParams ): PagedAsyncIterableIterator { const iter = this.listVhdsPagingAll(resourceGroupName, name, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings?: PageSettings) => { if (settings?.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listVhdsPagingPage( resourceGroupName, name, options, settings ); } }; } private async *listVhdsPagingPage( resourceGroupName: string, name: string, options?: LabsListVhdsOptionalParams, settings?: PageSettings ): AsyncIterableIterator { let result: LabsListVhdsResponse; let continuationToken = settings?.continuationToken; if (!continuationToken) { result = await this._listVhds(resourceGroupName, name, options); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield page; } while (continuationToken) { result = await this._listVhdsNext( resourceGroupName, name, continuationToken, options ); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield page; } } private async *listVhdsPagingAll( resourceGroupName: string, name: string, options?: LabsListVhdsOptionalParams ): AsyncIterableIterator { for await (const page of this.listVhdsPagingPage( resourceGroupName, name, options )) { yield* page; } } /** * List labs in a subscription. * @param options The options parameters. */ private _listBySubscription( options?: LabsListBySubscriptionOptionalParams ): Promise { return this.client.sendOperationRequest( { options }, listBySubscriptionOperationSpec ); } /** * List labs in a resource group. * @param resourceGroupName The name of the resource group. * @param options The options parameters. */ private _listByResourceGroup( resourceGroupName: string, options?: LabsListByResourceGroupOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, options }, listByResourceGroupOperationSpec ); } /** * Get lab. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param options The options parameters. */ get( resourceGroupName: string, name: string, options?: LabsGetOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, name, options }, getOperationSpec ); } /** * Create or replace an existing lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param lab A lab. * @param options The options parameters. */ async beginCreateOrUpdate( resourceGroupName: string, name: string, lab: Lab, options?: LabsCreateOrUpdateOptionalParams ): Promise< PollerLike< PollOperationState, LabsCreateOrUpdateResponse > > { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; const sendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { let currentRawResponse: | coreClient.FullOperationResponse | undefined = undefined; const providedCallback = args.options?.onResponse; const callback: coreClient.RawResponseCallback = ( rawResponse: coreClient.FullOperationResponse, flatResponse: unknown ) => { currentRawResponse = rawResponse; providedCallback?.(rawResponse, flatResponse); }; const updatedArgs = { ...args, options: { ...args.options, onResponse: callback } }; const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse!.status, body: currentRawResponse!.parsedBody, headers: currentRawResponse!.headers.toJSON() } }; }; const lro = new LroImpl( sendOperation, { resourceGroupName, name, lab, options }, createOrUpdateOperationSpec ); const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); return poller; } /** * Create or replace an existing lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param lab A lab. * @param options The options parameters. */ async beginCreateOrUpdateAndWait( resourceGroupName: string, name: string, lab: Lab, options?: LabsCreateOrUpdateOptionalParams ): Promise { const poller = await this.beginCreateOrUpdate( resourceGroupName, name, lab, options ); return poller.pollUntilDone(); } /** * Delete lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param options The options parameters. */ async beginDelete( resourceGroupName: string, name: string, options?: LabsDeleteOptionalParams ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; const sendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { let currentRawResponse: | coreClient.FullOperationResponse | undefined = undefined; const providedCallback = args.options?.onResponse; const callback: coreClient.RawResponseCallback = ( rawResponse: coreClient.FullOperationResponse, flatResponse: unknown ) => { currentRawResponse = rawResponse; providedCallback?.(rawResponse, flatResponse); }; const updatedArgs = { ...args, options: { ...args.options, onResponse: callback } }; const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse!.status, body: currentRawResponse!.parsedBody, headers: currentRawResponse!.headers.toJSON() } }; }; const lro = new LroImpl( sendOperation, { resourceGroupName, name, options }, deleteOperationSpec ); const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); return poller; } /** * Delete lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param options The options parameters. */ async beginDeleteAndWait( resourceGroupName: string, name: string, options?: LabsDeleteOptionalParams ): Promise { const poller = await this.beginDelete(resourceGroupName, name, options); return poller.pollUntilDone(); } /** * Allows modifying tags of labs. All other properties will be ignored. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param lab A lab. * @param options The options parameters. */ update( resourceGroupName: string, name: string, lab: LabFragment, options?: LabsUpdateOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, name, lab, options }, updateOperationSpec ); } /** * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param options The options parameters. */ async beginClaimAnyVm( resourceGroupName: string, name: string, options?: LabsClaimAnyVmOptionalParams ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; const sendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { let currentRawResponse: | coreClient.FullOperationResponse | undefined = undefined; const providedCallback = args.options?.onResponse; const callback: coreClient.RawResponseCallback = ( rawResponse: coreClient.FullOperationResponse, flatResponse: unknown ) => { currentRawResponse = rawResponse; providedCallback?.(rawResponse, flatResponse); }; const updatedArgs = { ...args, options: { ...args.options, onResponse: callback } }; const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse!.status, body: currentRawResponse!.parsedBody, headers: currentRawResponse!.headers.toJSON() } }; }; const lro = new LroImpl( sendOperation, { resourceGroupName, name, options }, claimAnyVmOperationSpec ); const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); return poller; } /** * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param options The options parameters. */ async beginClaimAnyVmAndWait( resourceGroupName: string, name: string, options?: LabsClaimAnyVmOptionalParams ): Promise { const poller = await this.beginClaimAnyVm(resourceGroupName, name, options); return poller.pollUntilDone(); } /** * Create virtual machines in a lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. * @param options The options parameters. */ async beginCreateEnvironment( resourceGroupName: string, name: string, labVirtualMachineCreationParameter: LabVirtualMachineCreationParameter, options?: LabsCreateEnvironmentOptionalParams ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; const sendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { let currentRawResponse: | coreClient.FullOperationResponse | undefined = undefined; const providedCallback = args.options?.onResponse; const callback: coreClient.RawResponseCallback = ( rawResponse: coreClient.FullOperationResponse, flatResponse: unknown ) => { currentRawResponse = rawResponse; providedCallback?.(rawResponse, flatResponse); }; const updatedArgs = { ...args, options: { ...args.options, onResponse: callback } }; const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse!.status, body: currentRawResponse!.parsedBody, headers: currentRawResponse!.headers.toJSON() } }; }; const lro = new LroImpl( sendOperation, { resourceGroupName, name, labVirtualMachineCreationParameter, options }, createEnvironmentOperationSpec ); const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); return poller; } /** * Create virtual machines in a lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. * @param options The options parameters. */ async beginCreateEnvironmentAndWait( resourceGroupName: string, name: string, labVirtualMachineCreationParameter: LabVirtualMachineCreationParameter, options?: LabsCreateEnvironmentOptionalParams ): Promise { const poller = await this.beginCreateEnvironment( resourceGroupName, name, labVirtualMachineCreationParameter, options ); return poller.pollUntilDone(); } /** * Exports the lab resource usage into a storage account This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param exportResourceUsageParameters The parameters of the export operation. * @param options The options parameters. */ async beginExportResourceUsage( resourceGroupName: string, name: string, exportResourceUsageParameters: ExportResourceUsageParameters, options?: LabsExportResourceUsageOptionalParams ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; const sendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { let currentRawResponse: | coreClient.FullOperationResponse | undefined = undefined; const providedCallback = args.options?.onResponse; const callback: coreClient.RawResponseCallback = ( rawResponse: coreClient.FullOperationResponse, flatResponse: unknown ) => { currentRawResponse = rawResponse; providedCallback?.(rawResponse, flatResponse); }; const updatedArgs = { ...args, options: { ...args.options, onResponse: callback } }; const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse!.status, body: currentRawResponse!.parsedBody, headers: currentRawResponse!.headers.toJSON() } }; }; const lro = new LroImpl( sendOperation, { resourceGroupName, name, exportResourceUsageParameters, options }, exportResourceUsageOperationSpec ); const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); return poller; } /** * Exports the lab resource usage into a storage account This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param exportResourceUsageParameters The parameters of the export operation. * @param options The options parameters. */ async beginExportResourceUsageAndWait( resourceGroupName: string, name: string, exportResourceUsageParameters: ExportResourceUsageParameters, options?: LabsExportResourceUsageOptionalParams ): Promise { const poller = await this.beginExportResourceUsage( resourceGroupName, name, exportResourceUsageParameters, options ); return poller.pollUntilDone(); } /** * Generate a URI for uploading custom disk images to a Lab. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param generateUploadUriParameter Properties for generating an upload URI. * @param options The options parameters. */ generateUploadUri( resourceGroupName: string, name: string, generateUploadUriParameter: GenerateUploadUriParameter, options?: LabsGenerateUploadUriOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, name, generateUploadUriParameter, options }, generateUploadUriOperationSpec ); } /** * Import a virtual machine into a different lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param importLabVirtualMachineRequest This represents the payload required to import a virtual * machine from a different lab into the current one * @param options The options parameters. */ async beginImportVirtualMachine( resourceGroupName: string, name: string, importLabVirtualMachineRequest: ImportLabVirtualMachineRequest, options?: LabsImportVirtualMachineOptionalParams ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; const sendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { let currentRawResponse: | coreClient.FullOperationResponse | undefined = undefined; const providedCallback = args.options?.onResponse; const callback: coreClient.RawResponseCallback = ( rawResponse: coreClient.FullOperationResponse, flatResponse: unknown ) => { currentRawResponse = rawResponse; providedCallback?.(rawResponse, flatResponse); }; const updatedArgs = { ...args, options: { ...args.options, onResponse: callback } }; const flatResponse = await directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse!.status, body: currentRawResponse!.parsedBody, headers: currentRawResponse!.headers.toJSON() } }; }; const lro = new LroImpl( sendOperation, { resourceGroupName, name, importLabVirtualMachineRequest, options }, importVirtualMachineOperationSpec ); const poller = new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); return poller; } /** * Import a virtual machine into a different lab. This operation can take a while to complete. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param importLabVirtualMachineRequest This represents the payload required to import a virtual * machine from a different lab into the current one * @param options The options parameters. */ async beginImportVirtualMachineAndWait( resourceGroupName: string, name: string, importLabVirtualMachineRequest: ImportLabVirtualMachineRequest, options?: LabsImportVirtualMachineOptionalParams ): Promise { const poller = await this.beginImportVirtualMachine( resourceGroupName, name, importLabVirtualMachineRequest, options ); return poller.pollUntilDone(); } /** * List disk images available for custom image creation. * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param options The options parameters. */ private _listVhds( resourceGroupName: string, name: string, options?: LabsListVhdsOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, name, options }, listVhdsOperationSpec ); } /** * ListBySubscriptionNext * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. * @param options The options parameters. */ private _listBySubscriptionNext( nextLink: string, options?: LabsListBySubscriptionNextOptionalParams ): Promise { return this.client.sendOperationRequest( { nextLink, options }, listBySubscriptionNextOperationSpec ); } /** * ListByResourceGroupNext * @param resourceGroupName The name of the resource group. * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. * @param options The options parameters. */ private _listByResourceGroupNext( resourceGroupName: string, nextLink: string, options?: LabsListByResourceGroupNextOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, nextLink, options }, listByResourceGroupNextOperationSpec ); } /** * ListVhdsNext * @param resourceGroupName The name of the resource group. * @param name The name of the lab. * @param nextLink The nextLink from the previous successful call to the ListVhds method. * @param options The options parameters. */ private _listVhdsNext( resourceGroupName: string, name: string, nextLink: string, options?: LabsListVhdsNextOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, name, nextLink, options }, listVhdsNextOperationSpec ); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listBySubscriptionOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.LabList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [ Parameters.apiVersion, Parameters.expand, Parameters.filter, Parameters.top, Parameters.orderby ], urlParameters: [Parameters.$host, Parameters.subscriptionId], headerParameters: [Parameters.accept], serializer }; const listByResourceGroupOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.LabList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [ Parameters.apiVersion, Parameters.expand, Parameters.filter, Parameters.top, Parameters.orderby ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName ], headerParameters: [Parameters.accept], serializer }; const getOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Lab }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion, Parameters.expand], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept], serializer }; const createOrUpdateOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.Lab }, 201: { bodyMapper: Mappers.Lab }, 202: { bodyMapper: Mappers.Lab }, 204: { bodyMapper: Mappers.Lab }, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.lab, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const deleteOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", httpMethod: "DELETE", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept], serializer }; const updateOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.Lab }, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.lab1, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const claimAnyVmOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm", httpMethod: "POST", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept], serializer }; const createEnvironmentOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment", httpMethod: "POST", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.labVirtualMachineCreationParameter, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const exportResourceUsageOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage", httpMethod: "POST", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.exportResourceUsageParameters, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const generateUploadUriOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri", httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.GenerateUploadUriResponse }, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.generateUploadUriParameter, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const importVirtualMachineOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine", httpMethod: "POST", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.importLabVirtualMachineRequest, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const listVhdsOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds", httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.LabVhdList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept], serializer }; const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.LabList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [ Parameters.apiVersion, Parameters.expand, Parameters.filter, Parameters.top, Parameters.orderby ], urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId ], headerParameters: [Parameters.accept], serializer }; const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.LabList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [ Parameters.apiVersion, Parameters.expand, Parameters.filter, Parameters.top, Parameters.orderby ], urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId, Parameters.resourceGroupName ], headerParameters: [Parameters.accept], serializer }; const listVhdsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.LabVhdList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.name ], headerParameters: [Parameters.accept], serializer };