diff --git a/lib/services/labServices/LICENSE.txt b/lib/services/labServices/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/labServices/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/labServices/README.md b/lib/services/labServices/README.md new file mode 100644 index 0000000000..88c868d473 --- /dev/null +++ b/lib/services/labServices/README.md @@ -0,0 +1,41 @@ +--- +uid: azure-arm-labservices +summary: *content + +--- +**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.** +## Microsoft Azure SDK for Node.js - ManagedLabsClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +### Features + + +### How to Install + +```bash +npm install azure-arm-labservices +``` + +### How to use + +#### Authentication, client creation and list providerOperations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const ManagedLabsClient = require("azure-arm-labservices"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new ManagedLabsClient(creds, subscriptionId); + return client.providerOperations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +### Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/labServices/lib/managedLabsClient.d.ts b/lib/services/labServices/lib/managedLabsClient.d.ts new file mode 100644 index 0000000000..ebbd6d20c1 --- /dev/null +++ b/lib/services/labServices/lib/managedLabsClient.d.ts @@ -0,0 +1,70 @@ +/* + * 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 { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class ManagedLabsClient extends AzureServiceClient { + /** + * Initializes a new instance of the ManagedLabsClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The subscription ID. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + apiVersion: string; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + providerOperations: operations.ProviderOperations; + globalUsers: operations.GlobalUsers; + labAccounts: operations.LabAccounts; + operations: operations.Operations; + galleryImages: operations.GalleryImages; + labs: operations.Labs; + environmentSettings: operations.EnvironmentSettings; + environments: operations.Environments; + users: operations.Users; +} + +export { ManagedLabsClient, models as ManagedLabsModels }; diff --git a/lib/services/labServices/lib/managedLabsClient.js b/lib/services/labServices/lib/managedLabsClient.js new file mode 100644 index 0000000000..afe39a1456 --- /dev/null +++ b/lib/services/labServices/lib/managedLabsClient.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a ManagedLabsClient. */ +class ManagedLabsClient extends ServiceClient { + /** + * Create a ManagedLabsClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The subscription ID. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2018-10-15'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.providerOperations = new operations.ProviderOperations(this); + this.globalUsers = new operations.GlobalUsers(this); + this.labAccounts = new operations.LabAccounts(this); + this.operations = new operations.Operations(this); + this.galleryImages = new operations.GalleryImages(this); + this.labs = new operations.Labs(this); + this.environmentSettings = new operations.EnvironmentSettings(this); + this.environments = new operations.Environments(this); + this.users = new operations.Users(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = ManagedLabsClient; +module.exports['default'] = ManagedLabsClient; +module.exports.ManagedLabsClient = ManagedLabsClient; +module.exports.ManagedLabsModels = models; diff --git a/lib/services/labServices/lib/models/addUsersPayload.js b/lib/services/labServices/lib/models/addUsersPayload.js new file mode 100644 index 0000000000..7e6b7de173 --- /dev/null +++ b/lib/services/labServices/lib/models/addUsersPayload.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload for Add Users operation on a Lab. + * + */ +class AddUsersPayload { + /** + * Create a AddUsersPayload. + * @property {array} emailAddresses List of user emails addresses to add to + * the lab. + */ + constructor() { + } + + /** + * Defines the metadata of AddUsersPayload + * + * @returns {object} metadata of AddUsersPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'AddUsersPayload', + type: { + name: 'Composite', + className: 'AddUsersPayload', + modelProperties: { + emailAddresses: { + required: true, + serializedName: 'emailAddresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = AddUsersPayload; diff --git a/lib/services/labServices/lib/models/createLabProperties.js b/lib/services/labServices/lib/models/createLabProperties.js new file mode 100644 index 0000000000..8a40b355f1 --- /dev/null +++ b/lib/services/labServices/lib/models/createLabProperties.js @@ -0,0 +1,122 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties for creating a managed lab and a default environment setting + * + */ +class CreateLabProperties { + /** + * Create a CreateLabProperties. + * @property {object} [environmentSettingCreationParameters] Settings related + * to creating an environment setting + * @property {object} + * [environmentSettingCreationParameters.resourceSettingCreationParameters] + * The resource specific settings + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * @property {object} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters] + * Creation parameters for Reference Vm + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName] + * The username of the virtual machine + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password] + * The password of the virtual machine. + * @property {object} labCreationParameters Settings related to creating a + * lab + * @property {number} [labCreationParameters.maxUsersInLab] Maximum number of + * users allowed in the lab. + * @property {string} name The name of the resource + * @property {string} [location] The location of the resource + * @property {object} [tags] The tags of the resource. + */ + constructor() { + } + + /** + * Defines the metadata of CreateLabProperties + * + * @returns {object} metadata of CreateLabProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'CreateLabProperties', + type: { + name: 'Composite', + className: 'CreateLabProperties', + modelProperties: { + environmentSettingCreationParameters: { + required: false, + serializedName: 'environmentSettingCreationParameters', + type: { + name: 'Composite', + className: 'EnvironmentSettingCreationParameters' + } + }, + labCreationParameters: { + required: true, + serializedName: 'labCreationParameters', + type: { + name: 'Composite', + className: 'LabCreationParameters' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CreateLabProperties; diff --git a/lib/services/labServices/lib/models/environment.js b/lib/services/labServices/lib/models/environment.js new file mode 100644 index 0000000000..26e3afaff1 --- /dev/null +++ b/lib/services/labServices/lib/models/environment.js @@ -0,0 +1,233 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an environment instance + * + * @extends models['Resource'] + */ +class Environment extends models['Resource'] { + /** + * Create a Environment. + * @property {object} [resourceSets] The set of a VM and the setting id it + * was created for + * @property {string} [resourceSets.vmResourceId] VM resource Id for the + * environment + * @property {string} [resourceSets.resourceSettingId] resourceSettingId for + * the environment + * @property {string} [claimedByUserObjectId] The AAD object Id of the user + * who has claimed the environment + * @property {string} [claimedByUserPrincipalId] The user principal Id of the + * user who has claimed the environment + * @property {string} [claimedByUserName] The name or email address of the + * user who has claimed the environment + * @property {boolean} [isClaimed] Is the environment claimed or not + * @property {string} [lastKnownPowerState] Last known power state of the + * environment + * @property {object} [networkInterface] Network details of the environment + * @property {string} [networkInterface.privateIpAddress] PrivateIp address + * of the Compute VM + * @property {string} [networkInterface.sshAuthority] Connection information + * for Linux + * @property {string} [networkInterface.rdpAuthority] Connection information + * for Windows + * @property {string} [networkInterface.username] Username of the VM + * @property {moment.duration} [totalUsage] How long the environment has been + * used by a lab user + * @property {date} [passwordLastReset] When the password was last reset on + * the environment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Environment + * + * @returns {object} metadata of Environment + * + */ + mapper() { + return { + required: false, + serializedName: 'Environment', + type: { + name: 'Composite', + className: 'Environment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + resourceSets: { + required: false, + serializedName: 'properties.resourceSets', + type: { + name: 'Composite', + className: 'ResourceSet' + } + }, + claimedByUserObjectId: { + required: false, + readOnly: true, + serializedName: 'properties.claimedByUserObjectId', + type: { + name: 'String' + } + }, + claimedByUserPrincipalId: { + required: false, + readOnly: true, + serializedName: 'properties.claimedByUserPrincipalId', + type: { + name: 'String' + } + }, + claimedByUserName: { + required: false, + readOnly: true, + serializedName: 'properties.claimedByUserName', + type: { + name: 'String' + } + }, + isClaimed: { + required: false, + readOnly: true, + serializedName: 'properties.isClaimed', + type: { + name: 'Boolean' + } + }, + lastKnownPowerState: { + required: false, + readOnly: true, + serializedName: 'properties.lastKnownPowerState', + type: { + name: 'String' + } + }, + networkInterface: { + required: false, + readOnly: true, + serializedName: 'properties.networkInterface', + type: { + name: 'Composite', + className: 'NetworkInterface' + } + }, + totalUsage: { + required: false, + readOnly: true, + serializedName: 'properties.totalUsage', + type: { + name: 'TimeSpan' + } + }, + passwordLastReset: { + required: false, + readOnly: true, + serializedName: 'properties.passwordLastReset', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = Environment; diff --git a/lib/services/labServices/lib/models/environmentDetails.js b/lib/services/labServices/lib/models/environmentDetails.js new file mode 100644 index 0000000000..e643801c49 --- /dev/null +++ b/lib/services/labServices/lib/models/environmentDetails.js @@ -0,0 +1,156 @@ +/* + * 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. + */ + +'use strict'; + +/** + * This represents the details about a User's environment and its state. + * + */ +class EnvironmentDetails { + /** + * Create a EnvironmentDetails. + * @property {string} [name] Name of the Environment + * @property {string} [description] Description of the Environment + * @property {string} [id] Resource Id of the environment + * @property {string} [provisioningState] The provisioning state of the + * environment. This also includes LabIsFull and NotYetProvisioned status. + * @property {object} [virtualMachineDetails] Details of backing DTL virtual + * machine with compute and network details. + * @property {string} [virtualMachineDetails.provisioningState] Provisioning + * state of the Dtl VM + * @property {string} [virtualMachineDetails.rdpAuthority] Connection + * information for Windows + * @property {string} [virtualMachineDetails.sshAuthority] Connection + * information for Linux + * @property {string} [virtualMachineDetails.privateIpAddress] PrivateIp + * address of the compute VM + * @property {string} [virtualMachineDetails.userName] Compute VM login user + * name + * @property {string} [virtualMachineDetails.lastKnownPowerState] Last known + * compute power state captured in DTL + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + * @property {string} [environmentState] Publishing state of the environment + * setting Possible values are Creating, Created, Failed + * @property {moment.duration} [totalUsage] How long the environment has been + * used by a lab user + * @property {date} [passwordLastReset] When the password was last reset on + * the environment. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentDetails + * + * @returns {object} metadata of EnvironmentDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentDetails', + type: { + name: 'Composite', + className: 'EnvironmentDetails', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + virtualMachineDetails: { + required: false, + readOnly: true, + serializedName: 'virtualMachineDetails', + type: { + name: 'Composite', + className: 'VirtualMachineDetails' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + }, + environmentState: { + required: false, + readOnly: true, + serializedName: 'environmentState', + type: { + name: 'String' + } + }, + totalUsage: { + required: false, + readOnly: true, + serializedName: 'totalUsage', + type: { + name: 'TimeSpan' + } + }, + passwordLastReset: { + required: false, + readOnly: true, + serializedName: 'passwordLastReset', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = EnvironmentDetails; diff --git a/lib/services/labServices/lib/models/environmentFragment.js b/lib/services/labServices/lib/models/environmentFragment.js new file mode 100644 index 0000000000..e3b7398d9c --- /dev/null +++ b/lib/services/labServices/lib/models/environmentFragment.js @@ -0,0 +1,125 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an environment instance + * + * @extends models['Resource'] + */ +class EnvironmentFragment extends models['Resource'] { + /** + * Create a EnvironmentFragment. + * @property {object} [resourceSets] The set of a VM and the setting id it + * was created for + * @property {string} [resourceSets.vmResourceId] VM resource Id for the + * environment + * @property {string} [resourceSets.resourceSettingId] resourceSettingId for + * the environment + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EnvironmentFragment + * + * @returns {object} metadata of EnvironmentFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentFragment', + type: { + name: 'Composite', + className: 'EnvironmentFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + resourceSets: { + required: false, + serializedName: 'properties.resourceSets', + type: { + name: 'Composite', + className: 'ResourceSetFragment' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentFragment; diff --git a/lib/services/labServices/lib/models/environmentOperationsPayload.js b/lib/services/labServices/lib/models/environmentOperationsPayload.js new file mode 100644 index 0000000000..25fc4f302a --- /dev/null +++ b/lib/services/labServices/lib/models/environmentOperationsPayload.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents payload for any Environment operations like get, start, stop, + * connect + * + */ +class EnvironmentOperationsPayload { + /** + * Create a EnvironmentOperationsPayload. + * @property {string} environmentId The resourceId of the environment + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentOperationsPayload + * + * @returns {object} metadata of EnvironmentOperationsPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentOperationsPayload', + type: { + name: 'Composite', + className: 'EnvironmentOperationsPayload', + modelProperties: { + environmentId: { + required: true, + serializedName: 'environmentId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentOperationsPayload; diff --git a/lib/services/labServices/lib/models/environmentSetting.js b/lib/services/labServices/lib/models/environmentSetting.js new file mode 100644 index 0000000000..b7f85f7c90 --- /dev/null +++ b/lib/services/labServices/lib/models/environmentSetting.js @@ -0,0 +1,235 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents settings of an environment, from which environment instances + * would be created + * + * @extends models['Resource'] + */ +class EnvironmentSetting extends models['Resource'] { + /** + * Create a EnvironmentSetting. + * @property {string} [publishingState] Describes the readiness of this + * environment setting. Possible values include: 'Draft', 'Publishing', + * 'Published', 'PublishFailed', 'Scaling' + * @property {string} [configurationState] Describes the user's progress in + * configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * @property {string} [description] Describes the environment and its + * resource settings + * @property {string} [title] Brief title describing the environment and its + * resource settings + * @property {object} resourceSettings The resource specific settings + * @property {string} [resourceSettings.id] The unique id of the resource + * setting + * @property {string} [resourceSettings.galleryImageResourceId] The resource + * id of the gallery image used for creating the virtual machine + * @property {string} [resourceSettings.imageName] The name of the image used + * to created the environment setting + * @property {string} [resourceSettings.size] The size of the virtual + * machine. Possible values include: 'Basic', 'Standard', 'Performance' + * @property {number} [resourceSettings.cores] The translated compute cores + * of the virtual machine + * @property {object} [resourceSettings.referenceVm] Details specific to + * Reference Vm + * @property {string} [resourceSettings.referenceVm.userName] The username of + * the virtual machine + * @property {string} [resourceSettings.referenceVm.password] The password of + * the virtual machine. This will be set to null in GET resource API + * @property {object} [resourceSettings.referenceVm.vmStateDetails] The state + * details for the reference virtual machine. + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.rdpAuthority] The + * RdpAuthority property is a server DNS host name or IP address followed by + * the service port number for RDP (Remote Desktop Protocol). + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.sshAuthority] The + * SshAuthority property is a server DNS host name or IP address followed by + * the service port number for SSH. + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.powerState] The power state + * of the reference virtual machine. + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.lastKnownPowerState] Last + * known compute power state captured in DTL + * @property {string} [resourceSettings.referenceVm.vmResourceId] VM resource + * Id for the environment + * @property {date} [lastChanged] Time when the template VM was last changed. + * @property {date} [lastPublished] Time when the template VM was last sent + * for publishing. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EnvironmentSetting + * + * @returns {object} metadata of EnvironmentSetting + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSetting', + type: { + name: 'Composite', + className: 'EnvironmentSetting', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + publishingState: { + required: false, + readOnly: true, + serializedName: 'properties.publishingState', + type: { + name: 'String' + } + }, + configurationState: { + required: false, + serializedName: 'properties.configurationState', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + title: { + required: false, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + resourceSettings: { + required: true, + serializedName: 'properties.resourceSettings', + type: { + name: 'Composite', + className: 'ResourceSettings' + } + }, + lastChanged: { + required: false, + readOnly: true, + serializedName: 'properties.lastChanged', + type: { + name: 'DateTime' + } + }, + lastPublished: { + required: false, + readOnly: true, + serializedName: 'properties.lastPublished', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSetting; diff --git a/lib/services/labServices/lib/models/environmentSettingCreationParameters.js b/lib/services/labServices/lib/models/environmentSettingCreationParameters.js new file mode 100644 index 0000000000..2ea897de75 --- /dev/null +++ b/lib/services/labServices/lib/models/environmentSettingCreationParameters.js @@ -0,0 +1,73 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Settings related to creating an environment setting + * + */ +class EnvironmentSettingCreationParameters { + /** + * Create a EnvironmentSettingCreationParameters. + * @property {object} resourceSettingCreationParameters The resource specific + * settings + * @property {string} [resourceSettingCreationParameters.location] The + * location where the virtual machine will live + * @property {string} [resourceSettingCreationParameters.name] The name of + * the resource setting + * @property {string} + * [resourceSettingCreationParameters.galleryImageResourceId] The resource id + * of the gallery image used for creating the virtual machine + * @property {string} [resourceSettingCreationParameters.size] The size of + * the virtual machine. Possible values include: 'Basic', 'Standard', + * 'Performance' + * @property {object} + * [resourceSettingCreationParameters.referenceVmCreationParameters] Creation + * parameters for Reference Vm + * @property {string} + * [resourceSettingCreationParameters.referenceVmCreationParameters.userName] + * The username of the virtual machine + * @property {string} + * [resourceSettingCreationParameters.referenceVmCreationParameters.password] + * The password of the virtual machine. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentSettingCreationParameters + * + * @returns {object} metadata of EnvironmentSettingCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSettingCreationParameters', + type: { + name: 'Composite', + className: 'EnvironmentSettingCreationParameters', + modelProperties: { + resourceSettingCreationParameters: { + required: true, + serializedName: 'resourceSettingCreationParameters', + type: { + name: 'Composite', + className: 'ResourceSettingCreationParameters' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSettingCreationParameters; diff --git a/lib/services/labServices/lib/models/environmentSettingFragment.js b/lib/services/labServices/lib/models/environmentSettingFragment.js new file mode 100644 index 0000000000..7caa42cdd9 --- /dev/null +++ b/lib/services/labServices/lib/models/environmentSettingFragment.js @@ -0,0 +1,159 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents settings of an environment, from which environment instances + * would be created + * + * @extends models['Resource'] + */ +class EnvironmentSettingFragment extends models['Resource'] { + /** + * Create a EnvironmentSettingFragment. + * @property {string} [configurationState] Describes the user's progress in + * configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * @property {string} [description] Describes the environment and its + * resource settings + * @property {string} [title] Brief title describing the environment and its + * resource settings + * @property {object} [resourceSettings] The resource specific settings + * @property {string} [resourceSettings.galleryImageResourceId] The resource + * id of the gallery image used for creating the virtual machine + * @property {string} [resourceSettings.size] The size of the virtual + * machine. Possible values include: 'Basic', 'Standard', 'Performance' + * @property {object} [resourceSettings.referenceVm] Details specific to + * Reference Vm + * @property {string} [resourceSettings.referenceVm.userName] The username of + * the virtual machine + * @property {string} [resourceSettings.referenceVm.password] The password of + * the virtual machine. This will be set to null in GET resource API + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EnvironmentSettingFragment + * + * @returns {object} metadata of EnvironmentSettingFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSettingFragment', + type: { + name: 'Composite', + className: 'EnvironmentSettingFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + configurationState: { + required: false, + serializedName: 'properties.configurationState', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + title: { + required: false, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + resourceSettings: { + required: false, + serializedName: 'properties.resourceSettings', + type: { + name: 'Composite', + className: 'ResourceSettingsFragment' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSettingFragment; diff --git a/lib/services/labServices/lib/models/environmentSize.js b/lib/services/labServices/lib/models/environmentSize.js new file mode 100644 index 0000000000..3b9fcb28fe --- /dev/null +++ b/lib/services/labServices/lib/models/environmentSize.js @@ -0,0 +1,103 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a size category supported by this Lab Account (small, medium or + * large) + * + */ +class EnvironmentSize { + /** + * Create a EnvironmentSize. + * @property {string} [name] The size category. Possible values include: + * 'Basic', 'Standard', 'Performance' + * @property {array} [vmSizes] Represents a set of compute sizes that can + * serve this given size type + * @property {number} [maxPrice] The pay-as-you-go dollar price per hour this + * size will cost. It does not include discounts and may not reflect the + * actual price the size will cost. This is the maximum price of all prices + * within this tier. + * @property {number} [minNumberOfCores] The number of cores a VM of this + * size has. This is the minimum number of cores within this tier. + * @property {number} [minMemory] The amount of memory available (in GB). + * This is the minimum amount of memory within this tier. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentSize + * + * @returns {object} metadata of EnvironmentSize + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSize', + type: { + name: 'Composite', + className: 'EnvironmentSize', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + vmSizes: { + required: false, + serializedName: 'vmSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SizeInfoElementType', + type: { + name: 'Composite', + className: 'SizeInfo' + } + } + } + }, + maxPrice: { + required: false, + readOnly: true, + serializedName: 'maxPrice', + type: { + name: 'Number' + } + }, + minNumberOfCores: { + required: false, + readOnly: true, + serializedName: 'minNumberOfCores', + type: { + name: 'Number' + } + }, + minMemory: { + required: false, + readOnly: true, + serializedName: 'minMemory', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSize; diff --git a/lib/services/labServices/lib/models/environmentSizeFragment.js b/lib/services/labServices/lib/models/environmentSizeFragment.js new file mode 100644 index 0000000000..c00cef8e55 --- /dev/null +++ b/lib/services/labServices/lib/models/environmentSizeFragment.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a size category supported by this Lab Account (small, medium or + * large) + * + */ +class EnvironmentSizeFragment { + /** + * Create a EnvironmentSizeFragment. + * @property {string} [name] The size category. Possible values include: + * 'Basic', 'Standard', 'Performance' + * @property {array} [vmSizes] Represents a set of compute sizes that can + * serve this given size type + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentSizeFragment + * + * @returns {object} metadata of EnvironmentSizeFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSizeFragment', + type: { + name: 'Composite', + className: 'EnvironmentSizeFragment', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + vmSizes: { + required: false, + serializedName: 'vmSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SizeInfoFragmentElementType', + type: { + name: 'Composite', + className: 'SizeInfoFragment' + } + } + } + } + } + } + }; + } +} + +module.exports = EnvironmentSizeFragment; diff --git a/lib/services/labServices/lib/models/galleryImage.js b/lib/services/labServices/lib/models/galleryImage.js new file mode 100644 index 0000000000..95d158b30a --- /dev/null +++ b/lib/services/labServices/lib/models/galleryImage.js @@ -0,0 +1,225 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an image from the Azure Marketplace + * + * @extends models['Resource'] + */ +class GalleryImage extends models['Resource'] { + /** + * Create a GalleryImage. + * @property {string} [author] The author of the gallery image. + * @property {date} [createdDate] The creation date of the gallery image. + * @property {string} [description] The description of the gallery image. + * @property {object} [imageReference] The image reference of the gallery + * image. + * @property {string} [imageReference.offer] The offer of the gallery image. + * @property {string} [imageReference.publisher] The publisher of the gallery + * image. + * @property {string} [imageReference.sku] The SKU of the gallery image. + * @property {string} [imageReference.osType] The OS type of the gallery + * image. + * @property {string} [imageReference.version] The version of the gallery + * image. + * @property {string} [icon] The icon of the gallery image. + * @property {boolean} [isEnabled] Indicates whether this gallery image is + * enabled. + * @property {boolean} [isOverride] Indicates whether this gallery has been + * overridden for this lab account + * @property {string} [planId] The third party plan that applies to this + * image + * @property {boolean} [isPlanAuthorized] Indicates if the plan has been + * authorized for programmatic deployment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of GalleryImage + * + * @returns {object} metadata of GalleryImage + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImage', + type: { + name: 'Composite', + className: 'GalleryImage', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + author: { + required: false, + readOnly: true, + serializedName: 'properties.author', + type: { + name: 'String' + } + }, + createdDate: { + required: false, + readOnly: true, + serializedName: 'properties.createdDate', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + imageReference: { + required: false, + readOnly: true, + serializedName: 'properties.imageReference', + type: { + name: 'Composite', + className: 'GalleryImageReference' + } + }, + icon: { + required: false, + readOnly: true, + serializedName: 'properties.icon', + type: { + name: 'String' + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + isOverride: { + required: false, + serializedName: 'properties.isOverride', + type: { + name: 'Boolean' + } + }, + planId: { + required: false, + readOnly: true, + serializedName: 'properties.planId', + type: { + name: 'String' + } + }, + isPlanAuthorized: { + required: false, + serializedName: 'properties.isPlanAuthorized', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = GalleryImage; diff --git a/lib/services/labServices/lib/models/galleryImageFragment.js b/lib/services/labServices/lib/models/galleryImageFragment.js new file mode 100644 index 0000000000..38d4eb6657 --- /dev/null +++ b/lib/services/labServices/lib/models/galleryImageFragment.js @@ -0,0 +1,138 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an image from the Azure Marketplace + * + * @extends models['Resource'] + */ +class GalleryImageFragment extends models['Resource'] { + /** + * Create a GalleryImageFragment. + * @property {boolean} [isEnabled] Indicates whether this gallery image is + * enabled. + * @property {boolean} [isOverride] Indicates whether this gallery has been + * overridden for this lab account + * @property {boolean} [isPlanAuthorized] Indicates if the plan has been + * authorized for programmatic deployment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of GalleryImageFragment + * + * @returns {object} metadata of GalleryImageFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImageFragment', + type: { + name: 'Composite', + className: 'GalleryImageFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + isOverride: { + required: false, + serializedName: 'properties.isOverride', + type: { + name: 'Boolean' + } + }, + isPlanAuthorized: { + required: false, + serializedName: 'properties.isPlanAuthorized', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GalleryImageFragment; diff --git a/lib/services/labServices/lib/models/galleryImageReference.js b/lib/services/labServices/lib/models/galleryImageReference.js new file mode 100644 index 0000000000..b06982e70d --- /dev/null +++ b/lib/services/labServices/lib/models/galleryImageReference.js @@ -0,0 +1,84 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The reference information for an Azure Marketplace image. + * + */ +class GalleryImageReference { + /** + * Create a GalleryImageReference. + * @property {string} [offer] The offer of the gallery image. + * @property {string} [publisher] The publisher of the gallery image. + * @property {string} [sku] The SKU of the gallery image. + * @property {string} [osType] The OS type of the gallery image. + * @property {string} [version] The version of the gallery image. + */ + constructor() { + } + + /** + * Defines the metadata of GalleryImageReference + * + * @returns {object} metadata of GalleryImageReference + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImageReference', + type: { + name: 'Composite', + className: 'GalleryImageReference', + modelProperties: { + offer: { + required: false, + serializedName: 'offer', + type: { + name: 'String' + } + }, + publisher: { + required: false, + serializedName: 'publisher', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'String' + } + }, + osType: { + required: false, + serializedName: 'osType', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GalleryImageReference; diff --git a/lib/services/labServices/lib/models/galleryImageReferenceFragment.js b/lib/services/labServices/lib/models/galleryImageReferenceFragment.js new file mode 100644 index 0000000000..f7bfa406ed --- /dev/null +++ b/lib/services/labServices/lib/models/galleryImageReferenceFragment.js @@ -0,0 +1,84 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The reference information for an Azure Marketplace image. + * + */ +class GalleryImageReferenceFragment { + /** + * Create a GalleryImageReferenceFragment. + * @property {string} [offer] The offer of the gallery image. + * @property {string} [publisher] The publisher of the gallery image. + * @property {string} [sku] The SKU of the gallery image. + * @property {string} [osType] The OS type of the gallery image. + * @property {string} [version] The version of the gallery image. + */ + constructor() { + } + + /** + * Defines the metadata of GalleryImageReferenceFragment + * + * @returns {object} metadata of GalleryImageReferenceFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImageReferenceFragment', + type: { + name: 'Composite', + className: 'GalleryImageReferenceFragment', + modelProperties: { + offer: { + required: false, + serializedName: 'offer', + type: { + name: 'String' + } + }, + publisher: { + required: false, + serializedName: 'publisher', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'String' + } + }, + osType: { + required: false, + serializedName: 'osType', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GalleryImageReferenceFragment; diff --git a/lib/services/labServices/lib/models/getEnvironmentResponse.js b/lib/services/labServices/lib/models/getEnvironmentResponse.js new file mode 100644 index 0000000000..ad106420d8 --- /dev/null +++ b/lib/services/labServices/lib/models/getEnvironmentResponse.js @@ -0,0 +1,95 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the environments details + * + */ +class GetEnvironmentResponse { + /** + * Create a GetEnvironmentResponse. + * @property {object} [environment] Details of the environment + * @property {string} [environment.name] Name of the Environment + * @property {string} [environment.description] Description of the + * Environment + * @property {string} [environment.id] Resource Id of the environment + * @property {string} [environment.provisioningState] The provisioning state + * of the environment. This also includes LabIsFull and NotYetProvisioned + * status. + * @property {object} [environment.virtualMachineDetails] Details of backing + * DTL virtual machine with compute and network details. + * @property {string} [environment.virtualMachineDetails.provisioningState] + * Provisioning state of the Dtl VM + * @property {string} [environment.virtualMachineDetails.rdpAuthority] + * Connection information for Windows + * @property {string} [environment.virtualMachineDetails.sshAuthority] + * Connection information for Linux + * @property {string} [environment.virtualMachineDetails.privateIpAddress] + * PrivateIp address of the compute VM + * @property {string} [environment.virtualMachineDetails.userName] Compute VM + * login user name + * @property {string} [environment.virtualMachineDetails.lastKnownPowerState] + * Last known compute power state captured in DTL + * @property {object} [environment.latestOperationResult] The details of the + * latest operation. ex: status, error + * @property {string} [environment.latestOperationResult.status] The current + * status of the operation. + * @property {string} [environment.latestOperationResult.errorCode] Error + * code on failure. + * @property {string} [environment.latestOperationResult.errorMessage] The + * error message. + * @property {string} [environment.latestOperationResult.requestUri] Request + * URI of the operation. + * @property {string} [environment.latestOperationResult.httpMethod] The + * HttpMethod - PUT/POST/DELETE for the operation. + * @property {string} [environment.latestOperationResult.operationUrl] The + * URL to use to check long-running operation status + * @property {string} [environment.environmentState] Publishing state of the + * environment setting Possible values are Creating, Created, Failed + * @property {moment.duration} [environment.totalUsage] How long the + * environment has been used by a lab user + * @property {date} [environment.passwordLastReset] When the password was + * last reset on the environment. + */ + constructor() { + } + + /** + * Defines the metadata of GetEnvironmentResponse + * + * @returns {object} metadata of GetEnvironmentResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'GetEnvironmentResponse', + type: { + name: 'Composite', + className: 'GetEnvironmentResponse', + modelProperties: { + environment: { + required: false, + readOnly: true, + serializedName: 'environment', + type: { + name: 'Composite', + className: 'EnvironmentDetails' + } + } + } + } + }; + } +} + +module.exports = GetEnvironmentResponse; diff --git a/lib/services/labServices/lib/models/getPersonalPreferencesResponse.js b/lib/services/labServices/lib/models/getPersonalPreferencesResponse.js new file mode 100644 index 0000000000..ea2e08dacb --- /dev/null +++ b/lib/services/labServices/lib/models/getPersonalPreferencesResponse.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the PersonalPreferences for the user + * + */ +class GetPersonalPreferencesResponse { + /** + * Create a GetPersonalPreferencesResponse. + * @property {string} [id] Id to be used by the cache orchestrator + * @property {array} [favoriteLabResourceIds] Array of favorite lab resource + * ids + */ + constructor() { + } + + /** + * Defines the metadata of GetPersonalPreferencesResponse + * + * @returns {object} metadata of GetPersonalPreferencesResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'GetPersonalPreferencesResponse', + type: { + name: 'Composite', + className: 'GetPersonalPreferencesResponse', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + favoriteLabResourceIds: { + required: false, + serializedName: 'favoriteLabResourceIds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = GetPersonalPreferencesResponse; diff --git a/lib/services/labServices/lib/models/getRegionalAvailabilityResponse.js b/lib/services/labServices/lib/models/getRegionalAvailabilityResponse.js new file mode 100644 index 0000000000..cb9d915c39 --- /dev/null +++ b/lib/services/labServices/lib/models/getRegionalAvailabilityResponse.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response model from the GetRegionalAvailability action + * + */ +class GetRegionalAvailabilityResponse { + /** + * Create a GetRegionalAvailabilityResponse. + * @property {array} [regionalAvailability] Availability information for + * different size categories per region + */ + constructor() { + } + + /** + * Defines the metadata of GetRegionalAvailabilityResponse + * + * @returns {object} metadata of GetRegionalAvailabilityResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'GetRegionalAvailabilityResponse', + type: { + name: 'Composite', + className: 'GetRegionalAvailabilityResponse', + modelProperties: { + regionalAvailability: { + required: false, + serializedName: 'regionalAvailability', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RegionalAvailabilityElementType', + type: { + name: 'Composite', + className: 'RegionalAvailability' + } + } + } + } + } + } + }; + } +} + +module.exports = GetRegionalAvailabilityResponse; diff --git a/lib/services/labServices/lib/models/index.d.ts b/lib/services/labServices/lib/models/index.d.ts new file mode 100644 index 0000000000..4bade082fa --- /dev/null +++ b/lib/services/labServices/lib/models/index.d.ts @@ -0,0 +1,1335 @@ +/* + * 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 { BaseResource, CloudError } from "ms-rest-azure"; +import * as moment from "moment"; + +export { + + BaseResource, + CloudError +}; + +/** + * Payload for Add Users operation on a Lab. + */ +export interface AddUsersPayload { + /** + * List of user emails addresses to add to the lab. + */ + emailAddresses: string[]; +} + +/** + * Creation parameters for Reference Vm + */ +export interface ReferenceVmCreationParameters { + /** + * The username of the virtual machine + */ + userName: string; + /** + * The password of the virtual machine. + */ + password: string; +} + +/** + * Represents resource specific settings + */ +export interface ResourceSettingCreationParameters { + /** + * The location where the virtual machine will live + */ + location?: string; + /** + * The name of the resource setting + */ + name?: string; + /** + * The resource id of the gallery image used for creating the virtual machine + */ + galleryImageResourceId: string; + /** + * The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + */ + size?: string; + /** + * Creation parameters for Reference Vm + */ + referenceVmCreationParameters: ReferenceVmCreationParameters; +} + +/** + * Settings related to creating an environment setting + */ +export interface EnvironmentSettingCreationParameters { + /** + * The resource specific settings + */ + resourceSettingCreationParameters: ResourceSettingCreationParameters; +} + +/** + * Settings related to creating a lab + */ +export interface LabCreationParameters { + /** + * Maximum number of users allowed in the lab. + */ + maxUsersInLab?: number; +} + +/** + * Properties for creating a managed lab and a default environment setting + */ +export interface CreateLabProperties { + /** + * Settings related to creating an environment setting + */ + environmentSettingCreationParameters?: EnvironmentSettingCreationParameters; + /** + * Settings related to creating a lab + */ + labCreationParameters: LabCreationParameters; + /** + * The name of the resource + */ + name: string; + /** + * The location of the resource + */ + location?: string; + /** + * The tags of the resource. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * Represents a VM and the setting Id it was created for. + */ +export interface ResourceSet { + /** + * VM resource Id for the environment + */ + vmResourceId?: string; + /** + * resourceSettingId for the environment + */ + resourceSettingId?: string; +} + +/** + * Network details of the environment + */ +export interface NetworkInterface { + /** + * PrivateIp address of the Compute VM + */ + readonly privateIpAddress?: string; + /** + * Connection information for Linux + */ + readonly sshAuthority?: string; + /** + * Connection information for Windows + */ + readonly rdpAuthority?: string; + /** + * Username of the VM + */ + readonly username?: string; +} + +/** + * Details of the status of an operation. + */ +export interface LatestOperationResult { + /** + * The current status of the operation. + */ + readonly status?: string; + /** + * Error code on failure. + */ + readonly errorCode?: string; + /** + * The error message. + */ + readonly errorMessage?: string; + /** + * Request URI of the operation. + */ + readonly requestUri?: string; + /** + * The HttpMethod - PUT/POST/DELETE for the operation. + */ + readonly httpMethod?: string; + /** + * The URL to use to check long-running operation status + */ + readonly operationUrl?: string; +} + +/** + * An Azure resource. + */ +export interface Resource extends BaseResource { + /** + * The identifier of the resource. + */ + readonly id?: string; + /** + * The name of the resource. + */ + readonly name?: string; + /** + * The type of the resource. + */ + readonly type?: string; + /** + * The location of the resource. + */ + location?: string; + /** + * The tags of the resource. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * Represents an environment instance + */ +export interface Environment extends Resource { + /** + * The set of a VM and the setting id it was created for + */ + resourceSets?: ResourceSet; + /** + * The AAD object Id of the user who has claimed the environment + */ + readonly claimedByUserObjectId?: string; + /** + * The user principal Id of the user who has claimed the environment + */ + readonly claimedByUserPrincipalId?: string; + /** + * The name or email address of the user who has claimed the environment + */ + readonly claimedByUserName?: string; + /** + * Is the environment claimed or not + */ + readonly isClaimed?: boolean; + /** + * Last known power state of the environment + */ + readonly lastKnownPowerState?: string; + /** + * Network details of the environment + */ + readonly networkInterface?: NetworkInterface; + /** + * How long the environment has been used by a lab user + */ + readonly totalUsage?: moment.Duration; + /** + * When the password was last reset on the environment. + */ + readonly passwordLastReset?: Date; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Details of the backing virtual machine. + */ +export interface VirtualMachineDetails { + /** + * Provisioning state of the Dtl VM + */ + readonly provisioningState?: string; + /** + * Connection information for Windows + */ + readonly rdpAuthority?: string; + /** + * Connection information for Linux + */ + readonly sshAuthority?: string; + /** + * PrivateIp address of the compute VM + */ + readonly privateIpAddress?: string; + /** + * Compute VM login user name + */ + readonly userName?: string; + /** + * Last known compute power state captured in DTL + */ + readonly lastKnownPowerState?: string; +} + +/** + * This represents the details about a User's environment and its state. + */ +export interface EnvironmentDetails { + /** + * Name of the Environment + */ + readonly name?: string; + /** + * Description of the Environment + */ + readonly description?: string; + /** + * Resource Id of the environment + */ + readonly id?: string; + /** + * The provisioning state of the environment. This also includes LabIsFull and NotYetProvisioned + * status. + */ + readonly provisioningState?: string; + /** + * Details of backing DTL virtual machine with compute and network details. + */ + readonly virtualMachineDetails?: VirtualMachineDetails; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; + /** + * Publishing state of the environment setting Possible values are Creating, Created, Failed + */ + readonly environmentState?: string; + /** + * How long the environment has been used by a lab user + */ + readonly totalUsage?: moment.Duration; + /** + * When the password was last reset on the environment. + */ + readonly passwordLastReset?: Date; +} + +/** + * Represents a VM and the setting Id it was created for. + */ +export interface ResourceSetFragment { + /** + * VM resource Id for the environment + */ + vmResourceId?: string; + /** + * resourceSettingId for the environment + */ + resourceSettingId?: string; +} + +/** + * Represents an environment instance + */ +export interface EnvironmentFragment extends Resource { + /** + * The set of a VM and the setting id it was created for + */ + resourceSets?: ResourceSetFragment; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Represents payload for any Environment operations like get, start, stop, connect + */ +export interface EnvironmentOperationsPayload { + /** + * The resourceId of the environment + */ + environmentId: string; +} + +/** + * Details about the state of the reference virtual machine. + */ +export interface VmStateDetails { + /** + * The RdpAuthority property is a server DNS host name or IP address followed by the service port + * number for RDP (Remote Desktop Protocol). + */ + readonly rdpAuthority?: string; + /** + * The SshAuthority property is a server DNS host name or IP address followed by the service port + * number for SSH. + */ + readonly sshAuthority?: string; + /** + * The power state of the reference virtual machine. + */ + readonly powerState?: string; + /** + * Last known compute power state captured in DTL + */ + readonly lastKnownPowerState?: string; +} + +/** + * Details of a Reference Vm + */ +export interface ReferenceVm { + /** + * The username of the virtual machine + */ + userName: string; + /** + * The password of the virtual machine. This will be set to null in GET resource API + */ + password?: string; + /** + * The state details for the reference virtual machine. + */ + readonly vmStateDetails?: VmStateDetails; + /** + * VM resource Id for the environment + */ + readonly vmResourceId?: string; +} + +/** + * Represents resource specific settings + */ +export interface ResourceSettings { + /** + * The unique id of the resource setting + */ + readonly id?: string; + /** + * The resource id of the gallery image used for creating the virtual machine + */ + galleryImageResourceId?: string; + /** + * The name of the image used to created the environment setting + */ + readonly imageName?: string; + /** + * The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + */ + size?: string; + /** + * The translated compute cores of the virtual machine + */ + readonly cores?: number; + /** + * Details specific to Reference Vm + */ + referenceVm: ReferenceVm; +} + +/** + * Represents settings of an environment, from which environment instances would be created + */ +export interface EnvironmentSetting extends Resource { + /** + * Describes the readiness of this environment setting. Possible values include: 'Draft', + * 'Publishing', 'Published', 'PublishFailed', 'Scaling' + */ + readonly publishingState?: string; + /** + * Describes the user's progress in configuring their environment setting. Possible values + * include: 'NotApplicable', 'Completed' + */ + configurationState?: string; + /** + * Describes the environment and its resource settings + */ + description?: string; + /** + * Brief title describing the environment and its resource settings + */ + title?: string; + /** + * The resource specific settings + */ + resourceSettings: ResourceSettings; + /** + * Time when the template VM was last changed. + */ + readonly lastChanged?: Date; + /** + * Time when the template VM was last sent for publishing. + */ + readonly lastPublished?: Date; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Details of a Reference Vm + */ +export interface ReferenceVmFragment { + /** + * The username of the virtual machine + */ + userName?: string; + /** + * The password of the virtual machine. This will be set to null in GET resource API + */ + password?: string; +} + +/** + * Represents resource specific settings + */ +export interface ResourceSettingsFragment { + /** + * The resource id of the gallery image used for creating the virtual machine + */ + galleryImageResourceId?: string; + /** + * The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + */ + size?: string; + /** + * Details specific to Reference Vm + */ + referenceVm?: ReferenceVmFragment; +} + +/** + * Represents settings of an environment, from which environment instances would be created + */ +export interface EnvironmentSettingFragment extends Resource { + /** + * Describes the user's progress in configuring their environment setting. Possible values + * include: 'NotApplicable', 'Completed' + */ + configurationState?: string; + /** + * Describes the environment and its resource settings + */ + description?: string; + /** + * Brief title describing the environment and its resource settings + */ + title?: string; + /** + * The resource specific settings + */ + resourceSettings?: ResourceSettingsFragment; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Contains detailed information about a size + */ +export interface SizeInfo { + /** + * Represents the actual compute size, e.g. Standard_A2_v2. + */ + computeSize?: string; + /** + * The pay-as-you-go price per hour this size will cost. It does not include discounts and may + * not reflect the actual price the size will cost. + */ + price?: number; + /** + * The number of cores a VM of this size has. + */ + numberOfCores?: number; + /** + * The amount of memory available (in GB). + */ + memory?: number; +} + +/** + * Represents a size category supported by this Lab Account (small, medium or large) + */ +export interface EnvironmentSize { + /** + * The size category. Possible values include: 'Basic', 'Standard', 'Performance' + */ + name?: string; + /** + * Represents a set of compute sizes that can serve this given size type + */ + vmSizes?: SizeInfo[]; + /** + * The pay-as-you-go dollar price per hour this size will cost. It does not include discounts and + * may not reflect the actual price the size will cost. This is the maximum price of all prices + * within this tier. + */ + readonly maxPrice?: number; + /** + * The number of cores a VM of this size has. This is the minimum number of cores within this + * tier. + */ + readonly minNumberOfCores?: number; + /** + * The amount of memory available (in GB). This is the minimum amount of memory within this tier. + */ + readonly minMemory?: number; +} + +/** + * Contains detailed information about a size + */ +export interface SizeInfoFragment { + /** + * Represents the actual compute size, e.g. Standard_A2_v2. + */ + computeSize?: string; + /** + * The pay-as-you-go price per hour this size will cost. It does not include discounts and may + * not reflect the actual price the size will cost. + */ + price?: number; + /** + * The number of cores a VM of this size has. + */ + numberOfCores?: number; + /** + * The amount of memory available (in GB). + */ + memory?: number; +} + +/** + * Represents a size category supported by this Lab Account (small, medium or large) + */ +export interface EnvironmentSizeFragment { + /** + * The size category. Possible values include: 'Basic', 'Standard', 'Performance' + */ + name?: string; + /** + * Represents a set of compute sizes that can serve this given size type + */ + vmSizes?: SizeInfoFragment[]; +} + +/** + * The reference information for an Azure Marketplace image. + */ +export interface GalleryImageReference { + /** + * The offer of the gallery image. + */ + offer?: string; + /** + * The publisher of the gallery image. + */ + publisher?: string; + /** + * The SKU of the gallery image. + */ + sku?: string; + /** + * The OS type of the gallery image. + */ + osType?: string; + /** + * The version of the gallery image. + */ + version?: string; +} + +/** + * Represents an image from the Azure Marketplace + */ +export interface GalleryImage extends Resource { + /** + * The author of the gallery image. + */ + readonly author?: string; + /** + * The creation date of the gallery image. + */ + readonly createdDate?: Date; + /** + * The description of the gallery image. + */ + readonly description?: string; + /** + * The image reference of the gallery image. + */ + readonly imageReference?: GalleryImageReference; + /** + * The icon of the gallery image. + */ + readonly icon?: string; + /** + * Indicates whether this gallery image is enabled. + */ + isEnabled?: boolean; + /** + * Indicates whether this gallery has been overridden for this lab account + */ + isOverride?: boolean; + /** + * The third party plan that applies to this image + */ + readonly planId?: string; + /** + * Indicates if the plan has been authorized for programmatic deployment. + */ + isPlanAuthorized?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Represents an image from the Azure Marketplace + */ +export interface GalleryImageFragment extends Resource { + /** + * Indicates whether this gallery image is enabled. + */ + isEnabled?: boolean; + /** + * Indicates whether this gallery has been overridden for this lab account + */ + isOverride?: boolean; + /** + * Indicates if the plan has been authorized for programmatic deployment. + */ + isPlanAuthorized?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * The reference information for an Azure Marketplace image. + */ +export interface GalleryImageReferenceFragment { + /** + * The offer of the gallery image. + */ + offer?: string; + /** + * The publisher of the gallery image. + */ + publisher?: string; + /** + * The SKU of the gallery image. + */ + sku?: string; + /** + * The OS type of the gallery image. + */ + osType?: string; + /** + * The version of the gallery image. + */ + version?: string; +} + +/** + * Represents the environments details + */ +export interface GetEnvironmentResponse { + /** + * Details of the environment + */ + readonly environment?: EnvironmentDetails; +} + +/** + * Represents the PersonalPreferences for the user + */ +export interface GetPersonalPreferencesResponse { + /** + * Id to be used by the cache orchestrator + */ + id?: string; + /** + * Array of favorite lab resource ids + */ + favoriteLabResourceIds?: string[]; +} + +/** + * Represents the size information + */ +export interface SizeAvailability { + /** + * The category of the size (Basic, Standard, Performance). Possible values include: 'Basic', + * 'Standard', 'Performance' + */ + sizeCategory?: string; + /** + * Whether or not this size category is available + */ + isAvailable?: boolean; +} + +/** + * The availability information of sizes across regions + */ +export interface RegionalAvailability { + /** + * Corresponding region + */ + region?: string; + /** + * List of all the size information for the region + */ + sizeAvailabilities?: SizeAvailability[]; +} + +/** + * The response model from the GetRegionalAvailability action + */ +export interface GetRegionalAvailabilityResponse { + /** + * Availability information for different size categories per region + */ + regionalAvailability?: RegionalAvailability[]; +} + +/** + * Represents a lab. + */ +export interface Lab extends Resource { + /** + * Maximum number of users allowed in the lab. + */ + maxUsersInLab?: number; + /** + * Maximum value MaxUsersInLab can be set to, as specified by the service + */ + readonly userQuota?: number; + /** + * Invitation code that users can use to join a lab. + */ + readonly invitationCode?: string; + /** + * Object id of the user that created the lab. + */ + readonly createdByObjectId?: string; + /** + * Maximum duration a user can use an environment for in the lab. + */ + usageQuota?: moment.Duration; + /** + * Lab user access mode (open to all vs. restricted to those listed on the lab). Possible values + * include: 'Restricted', 'Open' + */ + userAccessMode?: string; + /** + * Lab creator name + */ + readonly createdByUserPrincipalName?: string; + /** + * Creation date for the lab + */ + readonly createdDate?: Date; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Represents the size configuration under the lab account + */ +export interface SizeConfigurationProperties { + /** + * Represents a list of size categories supported by this Lab Account (Small, Medium, Large) + */ + environmentSizes?: EnvironmentSize[]; +} + +/** + * Represents a lab account. + */ +export interface LabAccount extends Resource { + /** + * Represents the size configuration under the lab account + */ + readonly sizeConfiguration?: SizeConfigurationProperties; + /** + * Represents if region selection is enabled + */ + enabledRegionSelection?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Represents a lab account. + */ +export interface LabAccountFragment extends Resource { + /** + * Represents if region selection is enabled + */ + enabledRegionSelection?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * This represents the details about a lab that the User is in, and its state. + */ +export interface LabDetails { + /** + * Name of the lab + */ + name?: string; + /** + * The provisioning state of the lab. + */ + provisioningState?: string; + /** + * The Id of the lab. + */ + id?: string; + /** + * The maximum duration a user can use a VM in this lab. + */ + readonly usageQuota?: moment.Duration; +} + +/** + * Represents a lab. + */ +export interface LabFragment extends Resource { + /** + * Maximum number of users allowed in the lab. + */ + maxUsersInLab?: number; + /** + * Maximum duration a user can use an environment for in the lab. + */ + usageQuota?: moment.Duration; + /** + * Lab user access mode (open to all vs. restricted to those listed on the lab). Possible values + * include: 'Restricted', 'Open' + */ + userAccessMode?: string; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Represents the payload to list environments owned by a user + */ +export interface ListEnvironmentsPayload { + /** + * The resource Id of the lab + */ + labId?: string; +} + +/** + * Represents the list of environments owned by a user + */ +export interface ListEnvironmentsResponse { + /** + * List of all the evironments + */ + environments?: EnvironmentDetails[]; +} + +/** + * Lists the labs owned by a user + */ +export interface ListLabsResponse { + /** + * List of all the labs + */ + labs?: LabDetails[]; +} + +/** + * Payload to get the status of an operation + */ +export interface OperationBatchStatusPayload { + /** + * The operation url of long running operation + */ + urls: string[]; +} + +/** + * Represents the status of an operation that used the batch API. + */ +export interface OperationBatchStatusResponseItem { + /** + * status of the long running operation for an environment + */ + readonly operationUrl?: string; + /** + * status of the long running operation for an environment + */ + readonly status?: string; +} + +/** + * Status Details of the long running operation for an environment + */ +export interface OperationBatchStatusResponse { + /** + * Gets a collection of items that contain the operation url and status. + */ + readonly items?: OperationBatchStatusResponseItem[]; +} + +/** + * Error details for the operation in case of a failure. + */ +export interface OperationError { + /** + * The error code of the operation error. + */ + code?: string; + /** + * The error message of the operation error. + */ + message?: string; +} + +/** + * The object that describes the operations + */ +export interface OperationMetadataDisplay { + /** + * Friendly name of the resource provider + */ + provider?: string; + /** + * Resource type on which the operation is performed. + */ + resource?: string; + /** + * Operation type: read, write, delete, listKeys/action, etc. + */ + operation?: string; + /** + * Friendly name of the operation + */ + description?: string; +} + +/** + * The REST API operation supported by ManagedLab ResourceProvider. + */ +export interface OperationMetadata { + /** + * Operation name: {provider}/{resource}/{operation} + */ + name?: string; + /** + * The object that describes the operations + */ + display?: OperationMetadataDisplay; +} + +/** + * An Operation Result + */ +export interface OperationResult { + /** + * The operation status. + */ + status?: string; + /** + * Error details for the operation in case of a failure. + */ + error?: OperationError; +} + +/** + * Payload to get the status of an operation + */ +export interface OperationStatusPayload { + /** + * The operation url of long running operation + */ + operationUrl: string; +} + +/** + * Status Details of the long running operation for an environment + */ +export interface OperationStatusResponse { + /** + * status of the long running operation for an environment + */ + readonly status?: string; +} + +/** + * Represents payload for any Environment operations like get, start, stop, connect + */ +export interface PersonalPerferencesOperationsPayload { + /** + * Resource Id of the lab account + */ + labAccountResourceId?: string; + /** + * Enum indicating if user is adding or removing a favorite lab. Possible values include: 'Add', + * 'Remove' + */ + addRemove?: string; + /** + * Resource Id of the lab to add/remove from the favorites list + */ + labResourceId?: string; +} + +/** + * Payload for Publish operation on EnvironmentSetting. + */ +export interface PublishPayload { + /** + * Whether to use existing VM custom image when publishing. + */ + useExistingImage?: boolean; +} + +/** + * Represents payload for Register action. + */ +export interface RegisterPayload { + /** + * The registration code of the lab. + */ + registrationCode?: string; +} + +/** + * Represents the payload for resetting passwords. + */ +export interface ResetPasswordPayload { + /** + * The resourceId of the environment + */ + environmentId: string; + /** + * The username for which the password will be reset. + */ + username?: string; + /** + * The password to assign to the user specified in + */ + password?: string; +} + +/** + * Represents the size configuration under the lab account + */ +export interface SizeConfigurationPropertiesFragment { + /** + * Represents a list of size categories supported by this Lab Account (Small, Medium, Large) + */ + environmentSizes?: EnvironmentSizeFragment[]; +} + +/** + * The User registered to a lab + */ +export interface User extends Resource { + /** + * The user email address, as it was specified during registration. + */ + readonly email?: string; + /** + * The user family name, as it was specified during registration. + */ + readonly familyName?: string; + /** + * The user given name, as it was specified during registration. + */ + readonly givenName?: string; + /** + * The user tenant ID, as it was specified during registration. + */ + readonly tenantId?: string; + /** + * How long the user has used his VMs in this lab + */ + readonly totalUsage?: moment.Duration; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * The User registered to a lab + */ +export interface UserFragment extends Resource { + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Result of the request to list REST API operations + */ +export interface ProviderOperationResult extends Array { + /** + * URL to get the next set of operation list results if there are any. + */ + readonly nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationLabAccount extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationGalleryImage extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationLab extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationEnvironmentSetting extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationEnvironment extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationUser extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} diff --git a/lib/services/labServices/lib/models/index.js b/lib/services/labServices/lib/models/index.js new file mode 100644 index 0000000000..cb3aac3477 --- /dev/null +++ b/lib/services/labServices/lib/models/index.js @@ -0,0 +1,88 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.AddUsersPayload = require('./addUsersPayload'); +exports.ReferenceVmCreationParameters = require('./referenceVmCreationParameters'); +exports.ResourceSettingCreationParameters = require('./resourceSettingCreationParameters'); +exports.EnvironmentSettingCreationParameters = require('./environmentSettingCreationParameters'); +exports.LabCreationParameters = require('./labCreationParameters'); +exports.CreateLabProperties = require('./createLabProperties'); +exports.ResourceSet = require('./resourceSet'); +exports.NetworkInterface = require('./networkInterface'); +exports.LatestOperationResult = require('./latestOperationResult'); +exports.Resource = require('./resource'); +exports.Environment = require('./environment'); +exports.VirtualMachineDetails = require('./virtualMachineDetails'); +exports.EnvironmentDetails = require('./environmentDetails'); +exports.ResourceSetFragment = require('./resourceSetFragment'); +exports.EnvironmentFragment = require('./environmentFragment'); +exports.EnvironmentOperationsPayload = require('./environmentOperationsPayload'); +exports.VmStateDetails = require('./vmStateDetails'); +exports.ReferenceVm = require('./referenceVm'); +exports.ResourceSettings = require('./resourceSettings'); +exports.EnvironmentSetting = require('./environmentSetting'); +exports.ReferenceVmFragment = require('./referenceVmFragment'); +exports.ResourceSettingsFragment = require('./resourceSettingsFragment'); +exports.EnvironmentSettingFragment = require('./environmentSettingFragment'); +exports.SizeInfo = require('./sizeInfo'); +exports.EnvironmentSize = require('./environmentSize'); +exports.SizeInfoFragment = require('./sizeInfoFragment'); +exports.EnvironmentSizeFragment = require('./environmentSizeFragment'); +exports.GalleryImageReference = require('./galleryImageReference'); +exports.GalleryImage = require('./galleryImage'); +exports.GalleryImageFragment = require('./galleryImageFragment'); +exports.GalleryImageReferenceFragment = require('./galleryImageReferenceFragment'); +exports.GetEnvironmentResponse = require('./getEnvironmentResponse'); +exports.GetPersonalPreferencesResponse = require('./getPersonalPreferencesResponse'); +exports.SizeAvailability = require('./sizeAvailability'); +exports.RegionalAvailability = require('./regionalAvailability'); +exports.GetRegionalAvailabilityResponse = require('./getRegionalAvailabilityResponse'); +exports.Lab = require('./lab'); +exports.SizeConfigurationProperties = require('./sizeConfigurationProperties'); +exports.LabAccount = require('./labAccount'); +exports.LabAccountFragment = require('./labAccountFragment'); +exports.LabDetails = require('./labDetails'); +exports.LabFragment = require('./labFragment'); +exports.ListEnvironmentsPayload = require('./listEnvironmentsPayload'); +exports.ListEnvironmentsResponse = require('./listEnvironmentsResponse'); +exports.ListLabsResponse = require('./listLabsResponse'); +exports.OperationBatchStatusPayload = require('./operationBatchStatusPayload'); +exports.OperationBatchStatusResponseItem = require('./operationBatchStatusResponseItem'); +exports.OperationBatchStatusResponse = require('./operationBatchStatusResponse'); +exports.OperationError = require('./operationError'); +exports.OperationMetadataDisplay = require('./operationMetadataDisplay'); +exports.OperationMetadata = require('./operationMetadata'); +exports.OperationResult = require('./operationResult'); +exports.OperationStatusPayload = require('./operationStatusPayload'); +exports.OperationStatusResponse = require('./operationStatusResponse'); +exports.PersonalPerferencesOperationsPayload = require('./personalPerferencesOperationsPayload'); +exports.PublishPayload = require('./publishPayload'); +exports.RegisterPayload = require('./registerPayload'); +exports.ResetPasswordPayload = require('./resetPasswordPayload'); +exports.SizeConfigurationPropertiesFragment = require('./sizeConfigurationPropertiesFragment'); +exports.User = require('./user'); +exports.UserFragment = require('./userFragment'); +exports.ProviderOperationResult = require('./providerOperationResult'); +exports.ResponseWithContinuationLabAccount = require('./responseWithContinuationLabAccount'); +exports.ResponseWithContinuationGalleryImage = require('./responseWithContinuationGalleryImage'); +exports.ResponseWithContinuationLab = require('./responseWithContinuationLab'); +exports.ResponseWithContinuationEnvironmentSetting = require('./responseWithContinuationEnvironmentSetting'); +exports.ResponseWithContinuationEnvironment = require('./responseWithContinuationEnvironment'); +exports.ResponseWithContinuationUser = require('./responseWithContinuationUser'); diff --git a/lib/services/labServices/lib/models/lab.js b/lib/services/labServices/lib/models/lab.js new file mode 100644 index 0000000000..de045b8fcb --- /dev/null +++ b/lib/services/labServices/lib/models/lab.js @@ -0,0 +1,209 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab. + * + * @extends models['Resource'] + */ +class Lab extends models['Resource'] { + /** + * Create a Lab. + * @property {number} [maxUsersInLab] Maximum number of users allowed in the + * lab. + * @property {number} [userQuota] Maximum value MaxUsersInLab can be set to, + * as specified by the service + * @property {string} [invitationCode] Invitation code that users can use to + * join a lab. + * @property {string} [createdByObjectId] Object id of the user that created + * the lab. + * @property {moment.duration} [usageQuota] Maximum duration a user can use + * an environment for in the lab. + * @property {string} [userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * @property {string} [createdByUserPrincipalName] Lab creator name + * @property {date} [createdDate] Creation date for the lab + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Lab + * + * @returns {object} metadata of Lab + * + */ + mapper() { + return { + required: false, + serializedName: 'Lab', + type: { + name: 'Composite', + className: 'Lab', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + maxUsersInLab: { + required: false, + serializedName: 'properties.maxUsersInLab', + type: { + name: 'Number' + } + }, + userQuota: { + required: false, + readOnly: true, + serializedName: 'properties.userQuota', + type: { + name: 'Number' + } + }, + invitationCode: { + required: false, + readOnly: true, + serializedName: 'properties.invitationCode', + type: { + name: 'String' + } + }, + createdByObjectId: { + required: false, + readOnly: true, + serializedName: 'properties.createdByObjectId', + type: { + name: 'String' + } + }, + usageQuota: { + required: false, + serializedName: 'properties.usageQuota', + type: { + name: 'TimeSpan' + } + }, + userAccessMode: { + required: false, + serializedName: 'properties.userAccessMode', + type: { + name: 'String' + } + }, + createdByUserPrincipalName: { + required: false, + readOnly: true, + serializedName: 'properties.createdByUserPrincipalName', + type: { + name: 'String' + } + }, + createdDate: { + required: false, + readOnly: true, + serializedName: 'properties.createdDate', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = Lab; diff --git a/lib/services/labServices/lib/models/labAccount.js b/lib/services/labServices/lib/models/labAccount.js new file mode 100644 index 0000000000..e31e492c47 --- /dev/null +++ b/lib/services/labServices/lib/models/labAccount.js @@ -0,0 +1,155 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab account. + * + * @extends models['Resource'] + */ +class LabAccount extends models['Resource'] { + /** + * Create a LabAccount. + * @property {object} [sizeConfiguration] Represents the size configuration + * under the lab account + * @property {array} [sizeConfiguration.environmentSizes] Represents a list + * of size categories supported by this Lab Account (Small, Medium, Large) + * @property {boolean} [enabledRegionSelection] Represents if region + * selection is enabled + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LabAccount + * + * @returns {object} metadata of LabAccount + * + */ + mapper() { + return { + required: false, + serializedName: 'LabAccount', + type: { + name: 'Composite', + className: 'LabAccount', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sizeConfiguration: { + required: false, + readOnly: true, + serializedName: 'properties.sizeConfiguration', + type: { + name: 'Composite', + className: 'SizeConfigurationProperties' + } + }, + enabledRegionSelection: { + required: false, + serializedName: 'properties.enabledRegionSelection', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = LabAccount; diff --git a/lib/services/labServices/lib/models/labAccountFragment.js b/lib/services/labServices/lib/models/labAccountFragment.js new file mode 100644 index 0000000000..58f722cc5f --- /dev/null +++ b/lib/services/labServices/lib/models/labAccountFragment.js @@ -0,0 +1,120 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab account. + * + * @extends models['Resource'] + */ +class LabAccountFragment extends models['Resource'] { + /** + * Create a LabAccountFragment. + * @property {boolean} [enabledRegionSelection] Represents if region + * selection is enabled + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LabAccountFragment + * + * @returns {object} metadata of LabAccountFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'LabAccountFragment', + type: { + name: 'Composite', + className: 'LabAccountFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabledRegionSelection: { + required: false, + serializedName: 'properties.enabledRegionSelection', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LabAccountFragment; diff --git a/lib/services/labServices/lib/models/labCreationParameters.js b/lib/services/labServices/lib/models/labCreationParameters.js new file mode 100644 index 0000000000..603f5c2e4b --- /dev/null +++ b/lib/services/labServices/lib/models/labCreationParameters.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Settings related to creating a lab + * + */ +class LabCreationParameters { + /** + * Create a LabCreationParameters. + * @property {number} [maxUsersInLab] Maximum number of users allowed in the + * lab. + */ + constructor() { + } + + /** + * Defines the metadata of LabCreationParameters + * + * @returns {object} metadata of LabCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'LabCreationParameters', + type: { + name: 'Composite', + className: 'LabCreationParameters', + modelProperties: { + maxUsersInLab: { + required: false, + serializedName: 'maxUsersInLab', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = LabCreationParameters; diff --git a/lib/services/labServices/lib/models/labDetails.js b/lib/services/labServices/lib/models/labDetails.js new file mode 100644 index 0000000000..c7783e4a3e --- /dev/null +++ b/lib/services/labServices/lib/models/labDetails.js @@ -0,0 +1,78 @@ +/* + * 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. + */ + +'use strict'; + +/** + * This represents the details about a lab that the User is in, and its state. + * + */ +class LabDetails { + /** + * Create a LabDetails. + * @property {string} [name] Name of the lab + * @property {string} [provisioningState] The provisioning state of the lab. + * @property {string} [id] The Id of the lab. + * @property {moment.duration} [usageQuota] The maximum duration a user can + * use a VM in this lab. + */ + constructor() { + } + + /** + * Defines the metadata of LabDetails + * + * @returns {object} metadata of LabDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'LabDetails', + type: { + name: 'Composite', + className: 'LabDetails', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + usageQuota: { + required: false, + readOnly: true, + serializedName: 'usageQuota', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = LabDetails; diff --git a/lib/services/labServices/lib/models/labFragment.js b/lib/services/labServices/lib/models/labFragment.js new file mode 100644 index 0000000000..9c56747cf1 --- /dev/null +++ b/lib/services/labServices/lib/models/labFragment.js @@ -0,0 +1,139 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab. + * + * @extends models['Resource'] + */ +class LabFragment extends models['Resource'] { + /** + * Create a LabFragment. + * @property {number} [maxUsersInLab] Maximum number of users allowed in the + * lab. + * @property {moment.duration} [usageQuota] Maximum duration a user can use + * an environment for in the lab. + * @property {string} [userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LabFragment + * + * @returns {object} metadata of LabFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'LabFragment', + type: { + name: 'Composite', + className: 'LabFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + maxUsersInLab: { + required: false, + serializedName: 'properties.maxUsersInLab', + type: { + name: 'Number' + } + }, + usageQuota: { + required: false, + serializedName: 'properties.usageQuota', + type: { + name: 'TimeSpan' + } + }, + userAccessMode: { + required: false, + serializedName: 'properties.userAccessMode', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LabFragment; diff --git a/lib/services/labServices/lib/models/latestOperationResult.js b/lib/services/labServices/lib/models/latestOperationResult.js new file mode 100644 index 0000000000..0e0f595340 --- /dev/null +++ b/lib/services/labServices/lib/models/latestOperationResult.js @@ -0,0 +1,100 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of the status of an operation. + * + */ +class LatestOperationResult { + /** + * Create a LatestOperationResult. + * @property {string} [status] The current status of the operation. + * @property {string} [errorCode] Error code on failure. + * @property {string} [errorMessage] The error message. + * @property {string} [requestUri] Request URI of the operation. + * @property {string} [httpMethod] The HttpMethod - PUT/POST/DELETE for the + * operation. + * @property {string} [operationUrl] The URL to use to check long-running + * operation status + */ + constructor() { + } + + /** + * Defines the metadata of LatestOperationResult + * + * @returns {object} metadata of LatestOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LatestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult', + modelProperties: { + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + errorCode: { + required: false, + readOnly: true, + serializedName: 'errorCode', + type: { + name: 'String' + } + }, + errorMessage: { + required: false, + readOnly: true, + serializedName: 'errorMessage', + type: { + name: 'String' + } + }, + requestUri: { + required: false, + readOnly: true, + serializedName: 'requestUri', + type: { + name: 'String' + } + }, + httpMethod: { + required: false, + readOnly: true, + serializedName: 'httpMethod', + type: { + name: 'String' + } + }, + operationUrl: { + required: false, + readOnly: true, + serializedName: 'operationUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LatestOperationResult; diff --git a/lib/services/labServices/lib/models/listEnvironmentsPayload.js b/lib/services/labServices/lib/models/listEnvironmentsPayload.js new file mode 100644 index 0000000000..b36951ac7a --- /dev/null +++ b/lib/services/labServices/lib/models/listEnvironmentsPayload.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the payload to list environments owned by a user + * + */ +class ListEnvironmentsPayload { + /** + * Create a ListEnvironmentsPayload. + * @property {string} [labId] The resource Id of the lab + */ + constructor() { + } + + /** + * Defines the metadata of ListEnvironmentsPayload + * + * @returns {object} metadata of ListEnvironmentsPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'ListEnvironmentsPayload', + type: { + name: 'Composite', + className: 'ListEnvironmentsPayload', + modelProperties: { + labId: { + required: false, + serializedName: 'labId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListEnvironmentsPayload; diff --git a/lib/services/labServices/lib/models/listEnvironmentsResponse.js b/lib/services/labServices/lib/models/listEnvironmentsResponse.js new file mode 100644 index 0000000000..d1868f598e --- /dev/null +++ b/lib/services/labServices/lib/models/listEnvironmentsResponse.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the list of environments owned by a user + * + */ +class ListEnvironmentsResponse { + /** + * Create a ListEnvironmentsResponse. + * @property {array} [environments] List of all the evironments + */ + constructor() { + } + + /** + * Defines the metadata of ListEnvironmentsResponse + * + * @returns {object} metadata of ListEnvironmentsResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ListEnvironmentsResponse', + type: { + name: 'Composite', + className: 'ListEnvironmentsResponse', + modelProperties: { + environments: { + required: false, + serializedName: 'environments', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentDetailsElementType', + type: { + name: 'Composite', + className: 'EnvironmentDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = ListEnvironmentsResponse; diff --git a/lib/services/labServices/lib/models/listLabsResponse.js b/lib/services/labServices/lib/models/listLabsResponse.js new file mode 100644 index 0000000000..a44c7cd1b9 --- /dev/null +++ b/lib/services/labServices/lib/models/listLabsResponse.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Lists the labs owned by a user + * + */ +class ListLabsResponse { + /** + * Create a ListLabsResponse. + * @property {array} [labs] List of all the labs + */ + constructor() { + } + + /** + * Defines the metadata of ListLabsResponse + * + * @returns {object} metadata of ListLabsResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ListLabsResponse', + type: { + name: 'Composite', + className: 'ListLabsResponse', + modelProperties: { + labs: { + required: false, + serializedName: 'labs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LabDetailsElementType', + type: { + name: 'Composite', + className: 'LabDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = ListLabsResponse; diff --git a/lib/services/labServices/lib/models/networkInterface.js b/lib/services/labServices/lib/models/networkInterface.js new file mode 100644 index 0000000000..d326ced02c --- /dev/null +++ b/lib/services/labServices/lib/models/networkInterface.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Network details of the environment + * + */ +class NetworkInterface { + /** + * Create a NetworkInterface. + * @property {string} [privateIpAddress] PrivateIp address of the Compute VM + * @property {string} [sshAuthority] Connection information for Linux + * @property {string} [rdpAuthority] Connection information for Windows + * @property {string} [username] Username of the VM + */ + constructor() { + } + + /** + * Defines the metadata of NetworkInterface + * + * @returns {object} metadata of NetworkInterface + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterface', + type: { + name: 'Composite', + className: 'NetworkInterface', + modelProperties: { + privateIpAddress: { + required: false, + readOnly: true, + serializedName: 'privateIpAddress', + type: { + name: 'String' + } + }, + sshAuthority: { + required: false, + readOnly: true, + serializedName: 'sshAuthority', + type: { + name: 'String' + } + }, + rdpAuthority: { + required: false, + readOnly: true, + serializedName: 'rdpAuthority', + type: { + name: 'String' + } + }, + username: { + required: false, + readOnly: true, + serializedName: 'username', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterface; diff --git a/lib/services/labServices/lib/models/operationBatchStatusPayload.js b/lib/services/labServices/lib/models/operationBatchStatusPayload.js new file mode 100644 index 0000000000..5f23d3d610 --- /dev/null +++ b/lib/services/labServices/lib/models/operationBatchStatusPayload.js @@ -0,0 +1,59 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload to get the status of an operation + * + */ +class OperationBatchStatusPayload { + /** + * Create a OperationBatchStatusPayload. + * @property {array} urls The operation url of long running operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationBatchStatusPayload + * + * @returns {object} metadata of OperationBatchStatusPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationBatchStatusPayload', + type: { + name: 'Composite', + className: 'OperationBatchStatusPayload', + modelProperties: { + urls: { + required: true, + serializedName: 'urls', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationBatchStatusPayload; diff --git a/lib/services/labServices/lib/models/operationBatchStatusResponse.js b/lib/services/labServices/lib/models/operationBatchStatusResponse.js new file mode 100644 index 0000000000..2bcb238440 --- /dev/null +++ b/lib/services/labServices/lib/models/operationBatchStatusResponse.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Status Details of the long running operation for an environment + * + */ +class OperationBatchStatusResponse { + /** + * Create a OperationBatchStatusResponse. + * @property {array} [items] Gets a collection of items that contain the + * operation url and status. + */ + constructor() { + } + + /** + * Defines the metadata of OperationBatchStatusResponse + * + * @returns {object} metadata of OperationBatchStatusResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationBatchStatusResponse', + type: { + name: 'Composite', + className: 'OperationBatchStatusResponse', + modelProperties: { + items: { + required: false, + readOnly: true, + serializedName: 'items', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationBatchStatusResponseItemElementType', + type: { + name: 'Composite', + className: 'OperationBatchStatusResponseItem' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationBatchStatusResponse; diff --git a/lib/services/labServices/lib/models/operationBatchStatusResponseItem.js b/lib/services/labServices/lib/models/operationBatchStatusResponseItem.js new file mode 100644 index 0000000000..c22e60f8af --- /dev/null +++ b/lib/services/labServices/lib/models/operationBatchStatusResponseItem.js @@ -0,0 +1,64 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the status of an operation that used the batch API. + * + */ +class OperationBatchStatusResponseItem { + /** + * Create a OperationBatchStatusResponseItem. + * @property {string} [operationUrl] status of the long running operation for + * an environment + * @property {string} [status] status of the long running operation for an + * environment + */ + constructor() { + } + + /** + * Defines the metadata of OperationBatchStatusResponseItem + * + * @returns {object} metadata of OperationBatchStatusResponseItem + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationBatchStatusResponseItem', + type: { + name: 'Composite', + className: 'OperationBatchStatusResponseItem', + modelProperties: { + operationUrl: { + required: false, + readOnly: true, + serializedName: 'operationUrl', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationBatchStatusResponseItem; diff --git a/lib/services/labServices/lib/models/operationError.js b/lib/services/labServices/lib/models/operationError.js new file mode 100644 index 0000000000..0bd412effe --- /dev/null +++ b/lib/services/labServices/lib/models/operationError.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Error details for the operation in case of a failure. + * + */ +class OperationError { + /** + * Create a OperationError. + * @property {string} [code] The error code of the operation error. + * @property {string} [message] The error message of the operation error. + */ + constructor() { + } + + /** + * Defines the metadata of OperationError + * + * @returns {object} metadata of OperationError + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationError', + type: { + name: 'Composite', + className: 'OperationError', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationError; diff --git a/lib/services/labServices/lib/models/operationMetadata.js b/lib/services/labServices/lib/models/operationMetadata.js new file mode 100644 index 0000000000..130322eaf2 --- /dev/null +++ b/lib/services/labServices/lib/models/operationMetadata.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The REST API operation supported by ManagedLab ResourceProvider. + * + */ +class OperationMetadata { + /** + * Create a OperationMetadata. + * @property {string} [name] Operation name: + * {provider}/{resource}/{operation} + * @property {object} [display] The object that describes the operations + * @property {string} [display.provider] Friendly name of the resource + * provider + * @property {string} [display.resource] Resource type on which the operation + * is performed. + * @property {string} [display.operation] Operation type: read, write, + * delete, listKeys/action, etc. + * @property {string} [display.description] Friendly name of the operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationMetadata + * + * @returns {object} metadata of OperationMetadata + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationMetadata', + type: { + name: 'Composite', + className: 'OperationMetadata', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationMetadataDisplay' + } + } + } + } + }; + } +} + +module.exports = OperationMetadata; diff --git a/lib/services/labServices/lib/models/operationMetadataDisplay.js b/lib/services/labServices/lib/models/operationMetadataDisplay.js new file mode 100644 index 0000000000..22d6618847 --- /dev/null +++ b/lib/services/labServices/lib/models/operationMetadataDisplay.js @@ -0,0 +1,78 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The object that describes the operations + * + */ +class OperationMetadataDisplay { + /** + * Create a OperationMetadataDisplay. + * @property {string} [provider] Friendly name of the resource provider + * @property {string} [resource] Resource type on which the operation is + * performed. + * @property {string} [operation] Operation type: read, write, delete, + * listKeys/action, etc. + * @property {string} [description] Friendly name of the operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationMetadataDisplay + * + * @returns {object} metadata of OperationMetadataDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationMetadataDisplay', + type: { + name: 'Composite', + className: 'OperationMetadataDisplay', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationMetadataDisplay; diff --git a/lib/services/labServices/lib/models/operationResult.js b/lib/services/labServices/lib/models/operationResult.js new file mode 100644 index 0000000000..1ba24ba129 --- /dev/null +++ b/lib/services/labServices/lib/models/operationResult.js @@ -0,0 +1,65 @@ +/* + * 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. + */ + +'use strict'; + +/** + * An Operation Result + * + */ +class OperationResult { + /** + * Create a OperationResult. + * @property {string} [status] The operation status. + * @property {object} [error] Error details for the operation in case of a + * failure. + * @property {string} [error.code] The error code of the operation error. + * @property {string} [error.message] The error message of the operation + * error. + */ + constructor() { + } + + /** + * Defines the metadata of OperationResult + * + * @returns {object} metadata of OperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationResult', + type: { + name: 'Composite', + className: 'OperationResult', + modelProperties: { + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'OperationError' + } + } + } + } + }; + } +} + +module.exports = OperationResult; diff --git a/lib/services/labServices/lib/models/operationStatusPayload.js b/lib/services/labServices/lib/models/operationStatusPayload.js new file mode 100644 index 0000000000..37221932dc --- /dev/null +++ b/lib/services/labServices/lib/models/operationStatusPayload.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload to get the status of an operation + * + */ +class OperationStatusPayload { + /** + * Create a OperationStatusPayload. + * @property {string} operationUrl The operation url of long running + * operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationStatusPayload + * + * @returns {object} metadata of OperationStatusPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationStatusPayload', + type: { + name: 'Composite', + className: 'OperationStatusPayload', + modelProperties: { + operationUrl: { + required: true, + serializedName: 'operationUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationStatusPayload; diff --git a/lib/services/labServices/lib/models/operationStatusResponse.js b/lib/services/labServices/lib/models/operationStatusResponse.js new file mode 100644 index 0000000000..210c261c71 --- /dev/null +++ b/lib/services/labServices/lib/models/operationStatusResponse.js @@ -0,0 +1,54 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Status Details of the long running operation for an environment + * + */ +class OperationStatusResponse { + /** + * Create a OperationStatusResponse. + * @property {string} [status] status of the long running operation for an + * environment + */ + constructor() { + } + + /** + * Defines the metadata of OperationStatusResponse + * + * @returns {object} metadata of OperationStatusResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationStatusResponse', + type: { + name: 'Composite', + className: 'OperationStatusResponse', + modelProperties: { + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationStatusResponse; diff --git a/lib/services/labServices/lib/models/personalPerferencesOperationsPayload.js b/lib/services/labServices/lib/models/personalPerferencesOperationsPayload.js new file mode 100644 index 0000000000..4dc95446b3 --- /dev/null +++ b/lib/services/labServices/lib/models/personalPerferencesOperationsPayload.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents payload for any Environment operations like get, start, stop, + * connect + * + */ +class PersonalPerferencesOperationsPayload { + /** + * Create a PersonalPerferencesOperationsPayload. + * @property {string} [labAccountResourceId] Resource Id of the lab account + * @property {string} [addRemove] Enum indicating if user is adding or + * removing a favorite lab. Possible values include: 'Add', 'Remove' + * @property {string} [labResourceId] Resource Id of the lab to add/remove + * from the favorites list + */ + constructor() { + } + + /** + * Defines the metadata of PersonalPerferencesOperationsPayload + * + * @returns {object} metadata of PersonalPerferencesOperationsPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'PersonalPerferencesOperationsPayload', + type: { + name: 'Composite', + className: 'PersonalPerferencesOperationsPayload', + modelProperties: { + labAccountResourceId: { + required: false, + serializedName: 'labAccountResourceId', + type: { + name: 'String' + } + }, + addRemove: { + required: false, + serializedName: 'addRemove', + type: { + name: 'String' + } + }, + labResourceId: { + required: false, + serializedName: 'labResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PersonalPerferencesOperationsPayload; diff --git a/lib/services/labServices/lib/models/providerOperationResult.js b/lib/services/labServices/lib/models/providerOperationResult.js new file mode 100644 index 0000000000..232bb874da --- /dev/null +++ b/lib/services/labServices/lib/models/providerOperationResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Result of the request to list REST API operations + */ +class ProviderOperationResult extends Array { + /** + * Create a ProviderOperationResult. + * @property {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ProviderOperationResult + * + * @returns {object} metadata of ProviderOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ProviderOperationResult', + type: { + name: 'Composite', + className: 'ProviderOperationResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationMetadataElementType', + type: { + name: 'Composite', + className: 'OperationMetadata' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ProviderOperationResult; diff --git a/lib/services/labServices/lib/models/publishPayload.js b/lib/services/labServices/lib/models/publishPayload.js new file mode 100644 index 0000000000..7e312f6f70 --- /dev/null +++ b/lib/services/labServices/lib/models/publishPayload.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload for Publish operation on EnvironmentSetting. + * + */ +class PublishPayload { + /** + * Create a PublishPayload. + * @property {boolean} [useExistingImage] Whether to use existing VM custom + * image when publishing. + */ + constructor() { + } + + /** + * Defines the metadata of PublishPayload + * + * @returns {object} metadata of PublishPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'PublishPayload', + type: { + name: 'Composite', + className: 'PublishPayload', + modelProperties: { + useExistingImage: { + required: false, + serializedName: 'useExistingImage', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = PublishPayload; diff --git a/lib/services/labServices/lib/models/referenceVm.js b/lib/services/labServices/lib/models/referenceVm.js new file mode 100644 index 0000000000..b97fdea167 --- /dev/null +++ b/lib/services/labServices/lib/models/referenceVm.js @@ -0,0 +1,91 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of a Reference Vm + * + */ +class ReferenceVm { + /** + * Create a ReferenceVm. + * @property {string} userName The username of the virtual machine + * @property {string} [password] The password of the virtual machine. This + * will be set to null in GET resource API + * @property {object} [vmStateDetails] The state details for the reference + * virtual machine. + * @property {string} [vmStateDetails.rdpAuthority] The RdpAuthority property + * is a server DNS host name or IP address followed by the service port + * number for RDP (Remote Desktop Protocol). + * @property {string} [vmStateDetails.sshAuthority] The SshAuthority property + * is a server DNS host name or IP address followed by the service port + * number for SSH. + * @property {string} [vmStateDetails.powerState] The power state of the + * reference virtual machine. + * @property {string} [vmStateDetails.lastKnownPowerState] Last known compute + * power state captured in DTL + * @property {string} [vmResourceId] VM resource Id for the environment + */ + constructor() { + } + + /** + * Defines the metadata of ReferenceVm + * + * @returns {object} metadata of ReferenceVm + * + */ + mapper() { + return { + required: false, + serializedName: 'ReferenceVm', + type: { + name: 'Composite', + className: 'ReferenceVm', + modelProperties: { + userName: { + required: true, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + }, + vmStateDetails: { + required: false, + readOnly: true, + serializedName: 'vmStateDetails', + type: { + name: 'Composite', + className: 'VmStateDetails' + } + }, + vmResourceId: { + required: false, + readOnly: true, + serializedName: 'vmResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReferenceVm; diff --git a/lib/services/labServices/lib/models/referenceVmCreationParameters.js b/lib/services/labServices/lib/models/referenceVmCreationParameters.js new file mode 100644 index 0000000000..f9dc0ef3de --- /dev/null +++ b/lib/services/labServices/lib/models/referenceVmCreationParameters.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Creation parameters for Reference Vm + * + */ +class ReferenceVmCreationParameters { + /** + * Create a ReferenceVmCreationParameters. + * @property {string} userName The username of the virtual machine + * @property {string} password The password of the virtual machine. + */ + constructor() { + } + + /** + * Defines the metadata of ReferenceVmCreationParameters + * + * @returns {object} metadata of ReferenceVmCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ReferenceVmCreationParameters', + type: { + name: 'Composite', + className: 'ReferenceVmCreationParameters', + modelProperties: { + userName: { + required: true, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: true, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReferenceVmCreationParameters; diff --git a/lib/services/labServices/lib/models/referenceVmFragment.js b/lib/services/labServices/lib/models/referenceVmFragment.js new file mode 100644 index 0000000000..fe5a2f1b46 --- /dev/null +++ b/lib/services/labServices/lib/models/referenceVmFragment.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of a Reference Vm + * + */ +class ReferenceVmFragment { + /** + * Create a ReferenceVmFragment. + * @property {string} [userName] The username of the virtual machine + * @property {string} [password] The password of the virtual machine. This + * will be set to null in GET resource API + */ + constructor() { + } + + /** + * Defines the metadata of ReferenceVmFragment + * + * @returns {object} metadata of ReferenceVmFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'ReferenceVmFragment', + type: { + name: 'Composite', + className: 'ReferenceVmFragment', + modelProperties: { + userName: { + required: false, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReferenceVmFragment; diff --git a/lib/services/labServices/lib/models/regionalAvailability.js b/lib/services/labServices/lib/models/regionalAvailability.js new file mode 100644 index 0000000000..a18f652db8 --- /dev/null +++ b/lib/services/labServices/lib/models/regionalAvailability.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The availability information of sizes across regions + * + */ +class RegionalAvailability { + /** + * Create a RegionalAvailability. + * @property {string} [region] Corresponding region + * @property {array} [sizeAvailabilities] List of all the size information + * for the region + */ + constructor() { + } + + /** + * Defines the metadata of RegionalAvailability + * + * @returns {object} metadata of RegionalAvailability + * + */ + mapper() { + return { + required: false, + serializedName: 'RegionalAvailability', + type: { + name: 'Composite', + className: 'RegionalAvailability', + modelProperties: { + region: { + required: false, + serializedName: 'region', + type: { + name: 'String' + } + }, + sizeAvailabilities: { + required: false, + serializedName: 'sizeAvailabilities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SizeAvailabilityElementType', + type: { + name: 'Composite', + className: 'SizeAvailability' + } + } + } + } + } + } + }; + } +} + +module.exports = RegionalAvailability; diff --git a/lib/services/labServices/lib/models/registerPayload.js b/lib/services/labServices/lib/models/registerPayload.js new file mode 100644 index 0000000000..5af9b3aa1a --- /dev/null +++ b/lib/services/labServices/lib/models/registerPayload.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents payload for Register action. + * + */ +class RegisterPayload { + /** + * Create a RegisterPayload. + * @property {string} [registrationCode] The registration code of the lab. + */ + constructor() { + } + + /** + * Defines the metadata of RegisterPayload + * + * @returns {object} metadata of RegisterPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'RegisterPayload', + type: { + name: 'Composite', + className: 'RegisterPayload', + modelProperties: { + registrationCode: { + required: false, + serializedName: 'registrationCode', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegisterPayload; diff --git a/lib/services/labServices/lib/models/resetPasswordPayload.js b/lib/services/labServices/lib/models/resetPasswordPayload.js new file mode 100644 index 0000000000..d436143831 --- /dev/null +++ b/lib/services/labServices/lib/models/resetPasswordPayload.js @@ -0,0 +1,70 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the payload for resetting passwords. + * + */ +class ResetPasswordPayload { + /** + * Create a ResetPasswordPayload. + * @property {string} environmentId The resourceId of the environment + * @property {string} [username] The username for which the password will be + * reset. + * @property {string} [password] The password to assign to the user specified + * in + */ + constructor() { + } + + /** + * Defines the metadata of ResetPasswordPayload + * + * @returns {object} metadata of ResetPasswordPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'ResetPasswordPayload', + type: { + name: 'Composite', + className: 'ResetPasswordPayload', + modelProperties: { + environmentId: { + required: true, + serializedName: 'environmentId', + type: { + name: 'String' + } + }, + username: { + required: false, + serializedName: 'username', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResetPasswordPayload; diff --git a/lib/services/labServices/lib/models/resource.js b/lib/services/labServices/lib/models/resource.js new file mode 100644 index 0000000000..b87b434982 --- /dev/null +++ b/lib/services/labServices/lib/models/resource.js @@ -0,0 +1,98 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An Azure resource. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @property {string} [id] The identifier of the resource. + * @property {string} [name] The name of the resource. + * @property {string} [type] The type of the resource. + * @property {string} [location] The location of the resource. + * @property {object} [tags] The tags of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/labServices/lib/models/resourceSet.js b/lib/services/labServices/lib/models/resourceSet.js new file mode 100644 index 0000000000..0196d9a3ab --- /dev/null +++ b/lib/services/labServices/lib/models/resourceSet.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a VM and the setting Id it was created for. + * + */ +class ResourceSet { + /** + * Create a ResourceSet. + * @property {string} [vmResourceId] VM resource Id for the environment + * @property {string} [resourceSettingId] resourceSettingId for the + * environment + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSet + * + * @returns {object} metadata of ResourceSet + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSet', + type: { + name: 'Composite', + className: 'ResourceSet', + modelProperties: { + vmResourceId: { + required: false, + serializedName: 'vmResourceId', + type: { + name: 'String' + } + }, + resourceSettingId: { + required: false, + serializedName: 'resourceSettingId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceSet; diff --git a/lib/services/labServices/lib/models/resourceSetFragment.js b/lib/services/labServices/lib/models/resourceSetFragment.js new file mode 100644 index 0000000000..a86584680c --- /dev/null +++ b/lib/services/labServices/lib/models/resourceSetFragment.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a VM and the setting Id it was created for. + * + */ +class ResourceSetFragment { + /** + * Create a ResourceSetFragment. + * @property {string} [vmResourceId] VM resource Id for the environment + * @property {string} [resourceSettingId] resourceSettingId for the + * environment + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSetFragment + * + * @returns {object} metadata of ResourceSetFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSetFragment', + type: { + name: 'Composite', + className: 'ResourceSetFragment', + modelProperties: { + vmResourceId: { + required: false, + serializedName: 'vmResourceId', + type: { + name: 'String' + } + }, + resourceSettingId: { + required: false, + serializedName: 'resourceSettingId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceSetFragment; diff --git a/lib/services/labServices/lib/models/resourceSettingCreationParameters.js b/lib/services/labServices/lib/models/resourceSettingCreationParameters.js new file mode 100644 index 0000000000..700b3cf867 --- /dev/null +++ b/lib/services/labServices/lib/models/resourceSettingCreationParameters.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents resource specific settings + * + */ +class ResourceSettingCreationParameters { + /** + * Create a ResourceSettingCreationParameters. + * @property {string} [location] The location where the virtual machine will + * live + * @property {string} [name] The name of the resource setting + * @property {string} galleryImageResourceId The resource id of the gallery + * image used for creating the virtual machine + * @property {string} [size] The size of the virtual machine. Possible values + * include: 'Basic', 'Standard', 'Performance' + * @property {object} referenceVmCreationParameters Creation parameters for + * Reference Vm + * @property {string} [referenceVmCreationParameters.userName] The username + * of the virtual machine + * @property {string} [referenceVmCreationParameters.password] The password + * of the virtual machine. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSettingCreationParameters + * + * @returns {object} metadata of ResourceSettingCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSettingCreationParameters', + type: { + name: 'Composite', + className: 'ResourceSettingCreationParameters', + modelProperties: { + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + galleryImageResourceId: { + required: true, + serializedName: 'galleryImageResourceId', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + referenceVmCreationParameters: { + required: true, + serializedName: 'referenceVmCreationParameters', + type: { + name: 'Composite', + className: 'ReferenceVmCreationParameters' + } + } + } + } + }; + } +} + +module.exports = ResourceSettingCreationParameters; diff --git a/lib/services/labServices/lib/models/resourceSettings.js b/lib/services/labServices/lib/models/resourceSettings.js new file mode 100644 index 0000000000..c51e2e2b92 --- /dev/null +++ b/lib/services/labServices/lib/models/resourceSettings.js @@ -0,0 +1,118 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents resource specific settings + * + */ +class ResourceSettings { + /** + * Create a ResourceSettings. + * @property {string} [id] The unique id of the resource setting + * @property {string} [galleryImageResourceId] The resource id of the gallery + * image used for creating the virtual machine + * @property {string} [imageName] The name of the image used to created the + * environment setting + * @property {string} [size] The size of the virtual machine. Possible values + * include: 'Basic', 'Standard', 'Performance' + * @property {number} [cores] The translated compute cores of the virtual + * machine + * @property {object} referenceVm Details specific to Reference Vm + * @property {string} [referenceVm.userName] The username of the virtual + * machine + * @property {string} [referenceVm.password] The password of the virtual + * machine. This will be set to null in GET resource API + * @property {object} [referenceVm.vmStateDetails] The state details for the + * reference virtual machine. + * @property {string} [referenceVm.vmStateDetails.rdpAuthority] The + * RdpAuthority property is a server DNS host name or IP address followed by + * the service port number for RDP (Remote Desktop Protocol). + * @property {string} [referenceVm.vmStateDetails.sshAuthority] The + * SshAuthority property is a server DNS host name or IP address followed by + * the service port number for SSH. + * @property {string} [referenceVm.vmStateDetails.powerState] The power state + * of the reference virtual machine. + * @property {string} [referenceVm.vmStateDetails.lastKnownPowerState] Last + * known compute power state captured in DTL + * @property {string} [referenceVm.vmResourceId] VM resource Id for the + * environment + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSettings + * + * @returns {object} metadata of ResourceSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSettings', + type: { + name: 'Composite', + className: 'ResourceSettings', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + galleryImageResourceId: { + required: false, + serializedName: 'galleryImageResourceId', + type: { + name: 'String' + } + }, + imageName: { + required: false, + readOnly: true, + serializedName: 'imageName', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + cores: { + required: false, + readOnly: true, + serializedName: 'cores', + type: { + name: 'Number' + } + }, + referenceVm: { + required: true, + serializedName: 'referenceVm', + type: { + name: 'Composite', + className: 'ReferenceVm' + } + } + } + } + }; + } +} + +module.exports = ResourceSettings; diff --git a/lib/services/labServices/lib/models/resourceSettingsFragment.js b/lib/services/labServices/lib/models/resourceSettingsFragment.js new file mode 100644 index 0000000000..83e9e0dd4f --- /dev/null +++ b/lib/services/labServices/lib/models/resourceSettingsFragment.js @@ -0,0 +1,75 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents resource specific settings + * + */ +class ResourceSettingsFragment { + /** + * Create a ResourceSettingsFragment. + * @property {string} [galleryImageResourceId] The resource id of the gallery + * image used for creating the virtual machine + * @property {string} [size] The size of the virtual machine. Possible values + * include: 'Basic', 'Standard', 'Performance' + * @property {object} [referenceVm] Details specific to Reference Vm + * @property {string} [referenceVm.userName] The username of the virtual + * machine + * @property {string} [referenceVm.password] The password of the virtual + * machine. This will be set to null in GET resource API + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSettingsFragment + * + * @returns {object} metadata of ResourceSettingsFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSettingsFragment', + type: { + name: 'Composite', + className: 'ResourceSettingsFragment', + modelProperties: { + galleryImageResourceId: { + required: false, + serializedName: 'galleryImageResourceId', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + referenceVm: { + required: false, + serializedName: 'referenceVm', + type: { + name: 'Composite', + className: 'ReferenceVmFragment' + } + } + } + } + }; + } +} + +module.exports = ResourceSettingsFragment; diff --git a/lib/services/labServices/lib/models/responseWithContinuationEnvironment.js b/lib/services/labServices/lib/models/responseWithContinuationEnvironment.js new file mode 100644 index 0000000000..cf116dfea6 --- /dev/null +++ b/lib/services/labServices/lib/models/responseWithContinuationEnvironment.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationEnvironment extends Array { + /** + * Create a ResponseWithContinuationEnvironment. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationEnvironment + * + * @returns {object} metadata of ResponseWithContinuationEnvironment + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_Environment_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationEnvironment', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentElementType', + type: { + name: 'Composite', + className: 'Environment' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationEnvironment; diff --git a/lib/services/labServices/lib/models/responseWithContinuationEnvironmentSetting.js b/lib/services/labServices/lib/models/responseWithContinuationEnvironmentSetting.js new file mode 100644 index 0000000000..10dda716ec --- /dev/null +++ b/lib/services/labServices/lib/models/responseWithContinuationEnvironmentSetting.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationEnvironmentSetting extends Array { + /** + * Create a ResponseWithContinuationEnvironmentSetting. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationEnvironmentSetting + * + * @returns {object} metadata of ResponseWithContinuationEnvironmentSetting + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_EnvironmentSetting_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationEnvironmentSetting', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentSettingElementType', + type: { + name: 'Composite', + className: 'EnvironmentSetting' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationEnvironmentSetting; diff --git a/lib/services/labServices/lib/models/responseWithContinuationGalleryImage.js b/lib/services/labServices/lib/models/responseWithContinuationGalleryImage.js new file mode 100644 index 0000000000..ac52b6b373 --- /dev/null +++ b/lib/services/labServices/lib/models/responseWithContinuationGalleryImage.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationGalleryImage extends Array { + /** + * Create a ResponseWithContinuationGalleryImage. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationGalleryImage + * + * @returns {object} metadata of ResponseWithContinuationGalleryImage + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_GalleryImage_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationGalleryImage', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'GalleryImageElementType', + type: { + name: 'Composite', + className: 'GalleryImage' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationGalleryImage; diff --git a/lib/services/labServices/lib/models/responseWithContinuationLab.js b/lib/services/labServices/lib/models/responseWithContinuationLab.js new file mode 100644 index 0000000000..9e6521bf82 --- /dev/null +++ b/lib/services/labServices/lib/models/responseWithContinuationLab.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationLab extends Array { + /** + * Create a ResponseWithContinuationLab. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationLab + * + * @returns {object} metadata of ResponseWithContinuationLab + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_Lab_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationLab', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LabElementType', + type: { + name: 'Composite', + className: 'Lab' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationLab; diff --git a/lib/services/labServices/lib/models/responseWithContinuationLabAccount.js b/lib/services/labServices/lib/models/responseWithContinuationLabAccount.js new file mode 100644 index 0000000000..c55d9b515e --- /dev/null +++ b/lib/services/labServices/lib/models/responseWithContinuationLabAccount.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationLabAccount extends Array { + /** + * Create a ResponseWithContinuationLabAccount. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationLabAccount + * + * @returns {object} metadata of ResponseWithContinuationLabAccount + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_LabAccount_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationLabAccount', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LabAccountElementType', + type: { + name: 'Composite', + className: 'LabAccount' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationLabAccount; diff --git a/lib/services/labServices/lib/models/responseWithContinuationUser.js b/lib/services/labServices/lib/models/responseWithContinuationUser.js new file mode 100644 index 0000000000..eb9cbe69f3 --- /dev/null +++ b/lib/services/labServices/lib/models/responseWithContinuationUser.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationUser extends Array { + /** + * Create a ResponseWithContinuationUser. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationUser + * + * @returns {object} metadata of ResponseWithContinuationUser + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_User_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationUser', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UserElementType', + type: { + name: 'Composite', + className: 'User' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationUser; diff --git a/lib/services/labServices/lib/models/sizeAvailability.js b/lib/services/labServices/lib/models/sizeAvailability.js new file mode 100644 index 0000000000..05c80fb101 --- /dev/null +++ b/lib/services/labServices/lib/models/sizeAvailability.js @@ -0,0 +1,63 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the size information + * + */ +class SizeAvailability { + /** + * Create a SizeAvailability. + * @property {string} [sizeCategory] The category of the size (Basic, + * Standard, Performance). Possible values include: 'Basic', 'Standard', + * 'Performance' + * @property {boolean} [isAvailable] Whether or not this size category is + * available + */ + constructor() { + } + + /** + * Defines the metadata of SizeAvailability + * + * @returns {object} metadata of SizeAvailability + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeAvailability', + type: { + name: 'Composite', + className: 'SizeAvailability', + modelProperties: { + sizeCategory: { + required: false, + serializedName: 'sizeCategory', + type: { + name: 'String' + } + }, + isAvailable: { + required: false, + serializedName: 'isAvailable', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = SizeAvailability; diff --git a/lib/services/labServices/lib/models/sizeConfigurationProperties.js b/lib/services/labServices/lib/models/sizeConfigurationProperties.js new file mode 100644 index 0000000000..40600275f4 --- /dev/null +++ b/lib/services/labServices/lib/models/sizeConfigurationProperties.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the size configuration under the lab account + * + */ +class SizeConfigurationProperties { + /** + * Create a SizeConfigurationProperties. + * @property {array} [environmentSizes] Represents a list of size categories + * supported by this Lab Account (Small, Medium, Large) + */ + constructor() { + } + + /** + * Defines the metadata of SizeConfigurationProperties + * + * @returns {object} metadata of SizeConfigurationProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeConfigurationProperties', + type: { + name: 'Composite', + className: 'SizeConfigurationProperties', + modelProperties: { + environmentSizes: { + required: false, + serializedName: 'environmentSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentSizeElementType', + type: { + name: 'Composite', + className: 'EnvironmentSize' + } + } + } + } + } + } + }; + } +} + +module.exports = SizeConfigurationProperties; diff --git a/lib/services/labServices/lib/models/sizeConfigurationPropertiesFragment.js b/lib/services/labServices/lib/models/sizeConfigurationPropertiesFragment.js new file mode 100644 index 0000000000..7fe0191ff8 --- /dev/null +++ b/lib/services/labServices/lib/models/sizeConfigurationPropertiesFragment.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the size configuration under the lab account + * + */ +class SizeConfigurationPropertiesFragment { + /** + * Create a SizeConfigurationPropertiesFragment. + * @property {array} [environmentSizes] Represents a list of size categories + * supported by this Lab Account (Small, Medium, Large) + */ + constructor() { + } + + /** + * Defines the metadata of SizeConfigurationPropertiesFragment + * + * @returns {object} metadata of SizeConfigurationPropertiesFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeConfigurationPropertiesFragment', + type: { + name: 'Composite', + className: 'SizeConfigurationPropertiesFragment', + modelProperties: { + environmentSizes: { + required: false, + serializedName: 'environmentSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentSizeFragmentElementType', + type: { + name: 'Composite', + className: 'EnvironmentSizeFragment' + } + } + } + } + } + } + }; + } +} + +module.exports = SizeConfigurationPropertiesFragment; diff --git a/lib/services/labServices/lib/models/sizeInfo.js b/lib/services/labServices/lib/models/sizeInfo.js new file mode 100644 index 0000000000..ef68779b2c --- /dev/null +++ b/lib/services/labServices/lib/models/sizeInfo.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Contains detailed information about a size + * + */ +class SizeInfo { + /** + * Create a SizeInfo. + * @property {string} [computeSize] Represents the actual compute size, e.g. + * Standard_A2_v2. + * @property {number} [price] The pay-as-you-go price per hour this size will + * cost. It does not include discounts and may not reflect the actual price + * the size will cost. + * @property {number} [numberOfCores] The number of cores a VM of this size + * has. + * @property {number} [memory] The amount of memory available (in GB). + */ + constructor() { + } + + /** + * Defines the metadata of SizeInfo + * + * @returns {object} metadata of SizeInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeInfo', + type: { + name: 'Composite', + className: 'SizeInfo', + modelProperties: { + computeSize: { + required: false, + serializedName: 'computeSize', + type: { + name: 'String' + } + }, + price: { + required: false, + serializedName: 'price', + type: { + name: 'Number' + } + }, + numberOfCores: { + required: false, + serializedName: 'numberOfCores', + type: { + name: 'Number' + } + }, + memory: { + required: false, + serializedName: 'memory', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = SizeInfo; diff --git a/lib/services/labServices/lib/models/sizeInfoFragment.js b/lib/services/labServices/lib/models/sizeInfoFragment.js new file mode 100644 index 0000000000..a7cec899af --- /dev/null +++ b/lib/services/labServices/lib/models/sizeInfoFragment.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Contains detailed information about a size + * + */ +class SizeInfoFragment { + /** + * Create a SizeInfoFragment. + * @property {string} [computeSize] Represents the actual compute size, e.g. + * Standard_A2_v2. + * @property {number} [price] The pay-as-you-go price per hour this size will + * cost. It does not include discounts and may not reflect the actual price + * the size will cost. + * @property {number} [numberOfCores] The number of cores a VM of this size + * has. + * @property {number} [memory] The amount of memory available (in GB). + */ + constructor() { + } + + /** + * Defines the metadata of SizeInfoFragment + * + * @returns {object} metadata of SizeInfoFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeInfoFragment', + type: { + name: 'Composite', + className: 'SizeInfoFragment', + modelProperties: { + computeSize: { + required: false, + serializedName: 'computeSize', + type: { + name: 'String' + } + }, + price: { + required: false, + serializedName: 'price', + type: { + name: 'Number' + } + }, + numberOfCores: { + required: false, + serializedName: 'numberOfCores', + type: { + name: 'Number' + } + }, + memory: { + required: false, + serializedName: 'memory', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = SizeInfoFragment; diff --git a/lib/services/labServices/lib/models/user.js b/lib/services/labServices/lib/models/user.js new file mode 100644 index 0000000000..026b81166c --- /dev/null +++ b/lib/services/labServices/lib/models/user.js @@ -0,0 +1,183 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The User registered to a lab + * + * @extends models['Resource'] + */ +class User extends models['Resource'] { + /** + * Create a User. + * @property {string} [email] The user email address, as it was specified + * during registration. + * @property {string} [familyName] The user family name, as it was specified + * during registration. + * @property {string} [givenName] The user given name, as it was specified + * during registration. + * @property {string} [tenantId] The user tenant ID, as it was specified + * during registration. + * @property {moment.duration} [totalUsage] How long the user has used his + * VMs in this lab + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of User + * + * @returns {object} metadata of User + * + */ + mapper() { + return { + required: false, + serializedName: 'User', + type: { + name: 'Composite', + className: 'User', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + email: { + required: false, + readOnly: true, + serializedName: 'properties.email', + type: { + name: 'String' + } + }, + familyName: { + required: false, + readOnly: true, + serializedName: 'properties.familyName', + type: { + name: 'String' + } + }, + givenName: { + required: false, + readOnly: true, + serializedName: 'properties.givenName', + type: { + name: 'String' + } + }, + tenantId: { + required: false, + readOnly: true, + serializedName: 'properties.tenantId', + type: { + name: 'String' + } + }, + totalUsage: { + required: false, + readOnly: true, + serializedName: 'properties.totalUsage', + type: { + name: 'TimeSpan' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = User; diff --git a/lib/services/labServices/lib/models/userFragment.js b/lib/services/labServices/lib/models/userFragment.js new file mode 100644 index 0000000000..bef94a5f02 --- /dev/null +++ b/lib/services/labServices/lib/models/userFragment.js @@ -0,0 +1,111 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The User registered to a lab + * + * @extends models['Resource'] + */ +class UserFragment extends models['Resource'] { + /** + * Create a UserFragment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of UserFragment + * + * @returns {object} metadata of UserFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'UserFragment', + type: { + name: 'Composite', + className: 'UserFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UserFragment; diff --git a/lib/services/labServices/lib/models/virtualMachineDetails.js b/lib/services/labServices/lib/models/virtualMachineDetails.js new file mode 100644 index 0000000000..0844ed5e07 --- /dev/null +++ b/lib/services/labServices/lib/models/virtualMachineDetails.js @@ -0,0 +1,99 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of the backing virtual machine. + * + */ +class VirtualMachineDetails { + /** + * Create a VirtualMachineDetails. + * @property {string} [provisioningState] Provisioning state of the Dtl VM + * @property {string} [rdpAuthority] Connection information for Windows + * @property {string} [sshAuthority] Connection information for Linux + * @property {string} [privateIpAddress] PrivateIp address of the compute VM + * @property {string} [userName] Compute VM login user name + * @property {string} [lastKnownPowerState] Last known compute power state + * captured in DTL + */ + constructor() { + } + + /** + * Defines the metadata of VirtualMachineDetails + * + * @returns {object} metadata of VirtualMachineDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualMachineDetails', + type: { + name: 'Composite', + className: 'VirtualMachineDetails', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + rdpAuthority: { + required: false, + readOnly: true, + serializedName: 'rdpAuthority', + type: { + name: 'String' + } + }, + sshAuthority: { + required: false, + readOnly: true, + serializedName: 'sshAuthority', + type: { + name: 'String' + } + }, + privateIpAddress: { + required: false, + readOnly: true, + serializedName: 'privateIpAddress', + type: { + name: 'String' + } + }, + userName: { + required: false, + readOnly: true, + serializedName: 'userName', + type: { + name: 'String' + } + }, + lastKnownPowerState: { + required: false, + readOnly: true, + serializedName: 'lastKnownPowerState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualMachineDetails; diff --git a/lib/services/labServices/lib/models/vmStateDetails.js b/lib/services/labServices/lib/models/vmStateDetails.js new file mode 100644 index 0000000000..cd5ba6da21 --- /dev/null +++ b/lib/services/labServices/lib/models/vmStateDetails.js @@ -0,0 +1,85 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details about the state of the reference virtual machine. + * + */ +class VmStateDetails { + /** + * Create a VmStateDetails. + * @property {string} [rdpAuthority] The RdpAuthority property is a server + * DNS host name or IP address followed by the service port number for RDP + * (Remote Desktop Protocol). + * @property {string} [sshAuthority] The SshAuthority property is a server + * DNS host name or IP address followed by the service port number for SSH. + * @property {string} [powerState] The power state of the reference virtual + * machine. + * @property {string} [lastKnownPowerState] Last known compute power state + * captured in DTL + */ + constructor() { + } + + /** + * Defines the metadata of VmStateDetails + * + * @returns {object} metadata of VmStateDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'VmStateDetails', + type: { + name: 'Composite', + className: 'VmStateDetails', + modelProperties: { + rdpAuthority: { + required: false, + readOnly: true, + serializedName: 'rdpAuthority', + type: { + name: 'String' + } + }, + sshAuthority: { + required: false, + readOnly: true, + serializedName: 'sshAuthority', + type: { + name: 'String' + } + }, + powerState: { + required: false, + readOnly: true, + serializedName: 'powerState', + type: { + name: 'String' + } + }, + lastKnownPowerState: { + required: false, + readOnly: true, + serializedName: 'lastKnownPowerState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VmStateDetails; diff --git a/lib/services/labServices/lib/operations/environmentSettings.js b/lib/services/labServices/lib/operations/environmentSettings.js new file mode 100644 index 0000000000..d70595954d --- /dev/null +++ b/lib/services/labServices/lib/operations/environmentSettings.js @@ -0,0 +1,3630 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentSetting === null || environmentSetting === undefined) { + throw new Error('environmentSetting cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentSetting !== null && environmentSetting !== undefined) { + let requestModelMapper = new client.models['EnvironmentSettingFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentSetting, 'environmentSetting'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentSetting, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/claimAny'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (publishPayload === null || publishPayload === undefined) { + throw new Error('publishPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/publish'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (publishPayload !== null && publishPayload !== undefined) { + let requestModelMapper = new client.models['PublishPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, publishPayload, 'publishPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(publishPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _start(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentSetting === null || environmentSetting === undefined) { + throw new Error('environmentSetting cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentSetting !== null && environmentSetting !== undefined) { + let requestModelMapper = new client.models['EnvironmentSetting']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentSetting, 'environmentSetting'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentSetting, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/start'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/stop'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a EnvironmentSettings. */ +class EnvironmentSettings { + /** + * Create a EnvironmentSettings. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._claimAny = _claimAny; + this._publish = _publish; + this._start = _start; + this._stop = _stop; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginStart = _beginStart; + this._beginStop = _beginStop; + this._listNext = _listNext; + } + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback); + } + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback); + } + } + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + claimAnyWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + publishWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._start(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback); + } + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = EnvironmentSettings; diff --git a/lib/services/labServices/lib/operations/environments.js b/lib/services/labServices/lib/operations/environments.js new file mode 100644 index 0000000000..cc1e65a022 --- /dev/null +++ b/lib/services/labServices/lib/operations/environments.js @@ -0,0 +1,3528 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; +const moment = require('moment'); + +/** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (environment === null || environment === undefined) { + throw new Error('environment cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environment !== null && environment !== undefined) { + let requestModelMapper = new client.models['Environment']().mapper(); + requestModel = client.serialize(requestModelMapper, environment, 'environment'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environment, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (environment === null || environment === undefined) { + throw new Error('environment cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environment !== null && environment !== undefined) { + let requestModelMapper = new client.models['EnvironmentFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, environment, 'environment'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environment, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/claim'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (resetPasswordPayload === null || resetPasswordPayload === undefined) { + throw new Error('resetPasswordPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (resetPasswordPayload !== null && resetPasswordPayload !== undefined) { + let requestModelMapper = new client.models['ResetPasswordPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, resetPasswordPayload, 'resetPasswordPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(resetPasswordPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Environments. */ +class Environments { + /** + * Create a Environments. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._claim = _claim; + this._resetPassword = _resetPassword; + this._start = _start; + this._stop = _stop; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginResetPassword = _beginResetPassword; + this._beginStart = _beginStart; + this._beginStop = _beginStop; + this._listNext = _listNext; + } + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback); + } + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback); + } + } + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + claimWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + resetPasswordWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Environments; diff --git a/lib/services/labServices/lib/operations/galleryImages.js b/lib/services/labServices/lib/operations/galleryImages.js new file mode 100644 index 0000000000..056f926563 --- /dev/null +++ b/lib/services/labServices/lib/operations/galleryImages.js @@ -0,0 +1,1680 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationGalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, galleryImageName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (galleryImage === null || galleryImage === undefined) { + throw new Error('galleryImage cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (galleryImage !== null && galleryImage !== undefined) { + let requestModelMapper = new client.models['GalleryImage']().mapper(); + requestModel = client.serialize(requestModelMapper, galleryImage, 'galleryImage'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(galleryImage, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (galleryImage === null || galleryImage === undefined) { + throw new Error('galleryImage cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (galleryImage !== null && galleryImage !== undefined) { + let requestModelMapper = new client.models['GalleryImageFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, galleryImage, 'galleryImage'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(galleryImage, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationGalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a GalleryImages. */ +class GalleryImages { + /** + * Create a GalleryImages. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listNext = _listNext; + } + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, galleryImage, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback); + } + } + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback); + } + } + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, galleryImage, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback); + } + } + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = GalleryImages; diff --git a/lib/services/labServices/lib/operations/globalUsers.js b/lib/services/labServices/lib/operations/globalUsers.js new file mode 100644 index 0000000000..1ca36a23aa --- /dev/null +++ b/lib/services/labServices/lib/operations/globalUsers.js @@ -0,0 +1,3026 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetEnvironmentResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (environmentOperationsPayload === null || environmentOperationsPayload === undefined) { + throw new Error('environmentOperationsPayload cannot be null or undefined.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getEnvironment'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentOperationsPayload !== null && environmentOperationsPayload !== undefined) { + let requestModelMapper = new client.models['EnvironmentOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentOperationsPayload, 'environmentOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GetEnvironmentResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationBatchStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getOperationBatchStatus(userName, operationBatchStatusPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (operationBatchStatusPayload === null || operationBatchStatusPayload === undefined) { + throw new Error('operationBatchStatusPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (operationBatchStatusPayload !== null && operationBatchStatusPayload !== undefined) { + let requestModelMapper = new client.models['OperationBatchStatusPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, operationBatchStatusPayload, 'operationBatchStatusPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(operationBatchStatusPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationBatchStatusResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getOperationStatus(userName, operationStatusPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (operationStatusPayload === null || operationStatusPayload === undefined) { + throw new Error('operationStatusPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getOperationStatus'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (operationStatusPayload !== null && operationStatusPayload !== undefined) { + let requestModelMapper = new client.models['OperationStatusPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, operationStatusPayload, 'operationStatusPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(operationStatusPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationStatusResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPerferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPerferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPerferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPerferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetPersonalPreferencesResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getPersonalPreferences(userName, personalPerferencesOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (personalPerferencesOperationsPayload === null || personalPerferencesOperationsPayload === undefined) { + throw new Error('personalPerferencesOperationsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (personalPerferencesOperationsPayload !== null && personalPerferencesOperationsPayload !== undefined) { + let requestModelMapper = new client.models['PersonalPerferencesOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, personalPerferencesOperationsPayload, 'personalPerferencesOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(personalPerferencesOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GetPersonalPreferencesResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListEnvironmentsResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listEnvironments(userName, listEnvironmentsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (listEnvironmentsPayload === null || listEnvironmentsPayload === undefined) { + throw new Error('listEnvironmentsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/listEnvironments'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (listEnvironmentsPayload !== null && listEnvironmentsPayload !== undefined) { + let requestModelMapper = new client.models['ListEnvironmentsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, listEnvironmentsPayload, 'listEnvironmentsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(listEnvironmentsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ListEnvironmentsResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListLabsResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listLabs(userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/listLabs'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ListLabsResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _register(userName, registerPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (registerPayload === null || registerPayload === undefined) { + throw new Error('registerPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/register'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (registerPayload !== null && registerPayload !== undefined) { + let requestModelMapper = new client.models['RegisterPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, registerPayload, 'registerPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(registerPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _resetPassword(userName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginResetPassword(userName, resetPasswordPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _startEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStartEnvironment(userName, environmentOperationsPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stopEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStopEnvironment(userName, environmentOperationsPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginResetPassword(userName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (resetPasswordPayload === null || resetPasswordPayload === undefined) { + throw new Error('resetPasswordPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/resetPassword'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (resetPasswordPayload !== null && resetPasswordPayload !== undefined) { + let requestModelMapper = new client.models['ResetPasswordPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, resetPasswordPayload, 'resetPasswordPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(resetPasswordPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStartEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (environmentOperationsPayload === null || environmentOperationsPayload === undefined) { + throw new Error('environmentOperationsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/startEnvironment'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentOperationsPayload !== null && environmentOperationsPayload !== undefined) { + let requestModelMapper = new client.models['EnvironmentOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentOperationsPayload, 'environmentOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStopEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (environmentOperationsPayload === null || environmentOperationsPayload === undefined) { + throw new Error('environmentOperationsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/stopEnvironment'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentOperationsPayload !== null && environmentOperationsPayload !== undefined) { + let requestModelMapper = new client.models['EnvironmentOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentOperationsPayload, 'environmentOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a GlobalUsers. */ +class GlobalUsers { + /** + * Create a GlobalUsers. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getEnvironment = _getEnvironment; + this._getOperationBatchStatus = _getOperationBatchStatus; + this._getOperationStatus = _getOperationStatus; + this._getPersonalPreferences = _getPersonalPreferences; + this._listEnvironments = _listEnvironments; + this._listLabs = _listLabs; + this._register = _register; + this._resetPassword = _resetPassword; + this._startEnvironment = _startEnvironment; + this._stopEnvironment = _stopEnvironment; + this._beginResetPassword = _beginResetPassword; + this._beginStartEnvironment = _beginStartEnvironment; + this._beginStopEnvironment = _beginStopEnvironment; + } + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GetEnvironmentResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetEnvironmentResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getOperationBatchStatusWithHttpOperationResponse(userName, operationBatchStatusPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getOperationBatchStatus(userName, operationBatchStatusPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationBatchStatusResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationBatchStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationBatchStatus(userName, operationBatchStatusPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getOperationBatchStatus(userName, operationBatchStatusPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getOperationBatchStatus(userName, operationBatchStatusPayload, options, optionalCallback); + } + } + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getOperationStatusWithHttpOperationResponse(userName, operationStatusPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getOperationStatus(userName, operationStatusPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationStatusResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationStatus(userName, operationStatusPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getOperationStatus(userName, operationStatusPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getOperationStatus(userName, operationStatusPayload, options, optionalCallback); + } + } + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPerferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPerferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPerferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPerferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getPersonalPreferencesWithHttpOperationResponse(userName, personalPerferencesOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getPersonalPreferences(userName, personalPerferencesOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPerferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPerferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPerferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPerferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GetPersonalPreferencesResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetPersonalPreferencesResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getPersonalPreferences(userName, personalPerferencesOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getPersonalPreferences(userName, personalPerferencesOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getPersonalPreferences(userName, personalPerferencesOperationsPayload, options, optionalCallback); + } + } + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listEnvironmentsWithHttpOperationResponse(userName, listEnvironmentsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listEnvironments(userName, listEnvironmentsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ListEnvironmentsResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListEnvironmentsResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listEnvironments(userName, listEnvironmentsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listEnvironments(userName, listEnvironmentsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listEnvironments(userName, listEnvironmentsPayload, options, optionalCallback); + } + } + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listLabsWithHttpOperationResponse(userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listLabs(userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ListLabsResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListLabsResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listLabs(userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listLabs(userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listLabs(userName, options, optionalCallback); + } + } + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + registerWithHttpOperationResponse(userName, registerPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._register(userName, registerPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + register(userName, registerPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._register(userName, registerPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._register(userName, registerPayload, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + resetPasswordWithHttpOperationResponse(userName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(userName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._resetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resetPassword(userName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + startEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._startEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + startEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._startEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._startEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + stopEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stopEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._stopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stopEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(userName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginResetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(userName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginResetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginResetPassword(userName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStartEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStartEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStartEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStartEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStartEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStopEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStopEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStopEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + +} + +module.exports = GlobalUsers; diff --git a/lib/services/labServices/lib/operations/index.d.ts b/lib/services/labServices/lib/operations/index.d.ts new file mode 100644 index 0000000000..fe5ce5239c --- /dev/null +++ b/lib/services/labServices/lib/operations/index.d.ts @@ -0,0 +1,6080 @@ +/* + * 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 { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as moment from 'moment'; +import * as models from '../models'; + + +/** + * @class + * ProviderOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface ProviderOperations { + + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ProviderOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ProviderOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * GlobalUsers + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface GlobalUsers { + + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GetEnvironmentResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GetEnvironmentResponse} [result] - The deserialized result object if an error did not occur. + * See {@link GetEnvironmentResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + getEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getOperationBatchStatusWithHttpOperationResponse(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationBatchStatusResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationBatchStatusResponse} [result] - The deserialized result object if an error did not occur. + * See {@link OperationBatchStatusResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationBatchStatus(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getOperationBatchStatus(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, callback: ServiceCallback): void; + getOperationBatchStatus(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getOperationStatusWithHttpOperationResponse(userName: string, operationStatusPayload: models.OperationStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationStatusResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationStatusResponse} [result] - The deserialized result object if an error did not occur. + * See {@link OperationStatusResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationStatus(userName: string, operationStatusPayload: models.OperationStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getOperationStatus(userName: string, operationStatusPayload: models.OperationStatusPayload, callback: ServiceCallback): void; + getOperationStatus(userName: string, operationStatusPayload: models.OperationStatusPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPerferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPerferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPerferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPerferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getPersonalPreferencesWithHttpOperationResponse(userName: string, personalPerferencesOperationsPayload: models.PersonalPerferencesOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPerferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPerferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPerferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPerferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GetPersonalPreferencesResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GetPersonalPreferencesResponse} [result] - The deserialized result object if an error did not occur. + * See {@link GetPersonalPreferencesResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getPersonalPreferences(userName: string, personalPerferencesOperationsPayload: models.PersonalPerferencesOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getPersonalPreferences(userName: string, personalPerferencesOperationsPayload: models.PersonalPerferencesOperationsPayload, callback: ServiceCallback): void; + getPersonalPreferences(userName: string, personalPerferencesOperationsPayload: models.PersonalPerferencesOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listEnvironmentsWithHttpOperationResponse(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ListEnvironmentsResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ListEnvironmentsResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ListEnvironmentsResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listEnvironments(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listEnvironments(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, callback: ServiceCallback): void; + listEnvironments(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listLabsWithHttpOperationResponse(userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ListLabsResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ListLabsResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ListLabsResponse} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listLabs(userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listLabs(userName: string, callback: ServiceCallback): void; + listLabs(userName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + registerWithHttpOperationResponse(userName: string, registerPayload: models.RegisterPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + register(userName: string, registerPayload: models.RegisterPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + register(userName: string, registerPayload: models.RegisterPayload, callback: ServiceCallback): void; + register(userName: string, registerPayload: models.RegisterPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + resetPasswordWithHttpOperationResponse(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + resetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + startEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + startEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + startEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + startEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + stopEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + stopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + beginResetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStartEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStartEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStartEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + beginStartEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStopEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + beginStopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LabAccounts + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface LabAccounts { + + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createLabWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createLab(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createLab(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, callback: ServiceCallback): void; + createLab(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getRegionalAvailabilityWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GetRegionalAvailabilityResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GetRegionalAvailabilityResponse} [result] - The deserialized result object if an error did not occur. + * See {@link GetRegionalAvailabilityResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getRegionalAvailability(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getRegionalAvailability(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + getRegionalAvailability(resourceGroupName: string, labAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Operations { + + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(locationName: string, operationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(locationName: string, operationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(locationName: string, operationName: string, callback: ServiceCallback): void; + get(locationName: string, operationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * GalleryImages + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface GalleryImages { + + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationGalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, galleryImageName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, galleryImageName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, galleryImageName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, galleryImageName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationGalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Labs + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Labs { + + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLab} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Lab} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Lab} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Lab} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + addUsersWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + addUsers(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + addUsers(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, callback: ServiceCallback): void; + addUsers(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + registerWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + register(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + register(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + register(resourceGroupName: string, labAccountName: string, labName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLab} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * EnvironmentSettings + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface EnvironmentSettings { + + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, labName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + claimAnyWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + claimAny(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + claimAny(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + claimAny(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + publishWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + publish(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + publish(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, callback: ServiceCallback): void; + publish(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Environments + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Environments { + + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironment} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Environment} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Environment} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Environment} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + claimWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + claim(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + claim(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + claim(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + resetPasswordWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + resetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + beginResetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironment} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Users + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Users { + + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationUser} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, labName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, userName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationUser} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/labServices/lib/operations/index.js b/lib/services/labServices/lib/operations/index.js new file mode 100644 index 0000000000..3b439d9ef6 --- /dev/null +++ b/lib/services/labServices/lib/operations/index.js @@ -0,0 +1,25 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.ProviderOperations = require('./providerOperations'); +exports.GlobalUsers = require('./globalUsers'); +exports.LabAccounts = require('./labAccounts'); +exports.Operations = require('./operations'); +exports.GalleryImages = require('./galleryImages'); +exports.Labs = require('./labs'); +exports.EnvironmentSettings = require('./environmentSettings'); +exports.Environments = require('./environments'); +exports.Users = require('./users'); diff --git a/lib/services/labServices/lib/operations/labAccounts.js b/lib/services/labServices/lib/operations/labAccounts.js new file mode 100644 index 0000000000..a029e6b09c --- /dev/null +++ b/lib/services/labServices/lib/operations/labAccounts.js @@ -0,0 +1,2852 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labaccounts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labAccount, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labAccount === null || labAccount === undefined) { + throw new Error('labAccount cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (labAccount !== null && labAccount !== undefined) { + let requestModelMapper = new client.models['LabAccount']().mapper(); + requestModel = client.serialize(requestModelMapper, labAccount, 'labAccount'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(labAccount, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labAccount, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labAccount === null || labAccount === undefined) { + throw new Error('labAccount cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (labAccount !== null && labAccount !== undefined) { + let requestModelMapper = new client.models['LabAccountFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, labAccount, 'labAccount'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(labAccount, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createLab(resourceGroupName, labAccountName, createLabProperties, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (createLabProperties === null || createLabProperties === undefined) { + throw new Error('createLabProperties cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/createLab'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (createLabProperties !== null && createLabProperties !== undefined) { + let requestModelMapper = new client.models['CreateLabProperties']().mapper(); + requestModel = client.serialize(requestModelMapper, createLabProperties, 'createLabProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(createLabProperties, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetRegionalAvailabilityResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getRegionalAvailability(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/getRegionalAvailability'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GetRegionalAvailabilityResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscriptionNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LabAccounts. */ +class LabAccounts { + /** + * Create a LabAccounts. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySubscription = _listBySubscription; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._createLab = _createLab; + this._getRegionalAvailability = _getRegionalAvailability; + this._beginDeleteMethod = _beginDeleteMethod; + this._listBySubscriptionNext = _listBySubscriptionNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labAccount, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labAccount, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labAccount, options, optionalCallback); + } + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labAccount, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labAccount, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labAccount, options, optionalCallback); + } + } + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createLabWithHttpOperationResponse(resourceGroupName, labAccountName, createLabProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createLab(resourceGroupName, labAccountName, createLabProperties, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createLab(resourceGroupName, labAccountName, createLabProperties, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createLab(resourceGroupName, labAccountName, createLabProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createLab(resourceGroupName, labAccountName, createLabProperties, options, optionalCallback); + } + } + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getRegionalAvailabilityWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getRegionalAvailability(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GetRegionalAvailabilityResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetRegionalAvailabilityResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getRegionalAvailability(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getRegionalAvailability(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getRegionalAvailability(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LabAccounts; diff --git a/lib/services/labServices/lib/operations/labs.js b/lib/services/labServices/lib/operations/labs.js new file mode 100644 index 0000000000..6c1943e021 --- /dev/null +++ b/lib/services/labServices/lib/operations/labs.js @@ -0,0 +1,2320 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; +const moment = require('moment'); + +/** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (lab === null || lab === undefined) { + throw new Error('lab cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (lab !== null && lab !== undefined) { + let requestModelMapper = new client.models['Lab']().mapper(); + requestModel = client.serialize(requestModelMapper, lab, 'lab'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(lab, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, lab, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (lab === null || lab === undefined) { + throw new Error('lab cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (lab !== null && lab !== undefined) { + let requestModelMapper = new client.models['LabFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, lab, 'lab'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(lab, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (addUsersPayload === null || addUsersPayload === undefined) { + throw new Error('addUsersPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/addUsers'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (addUsersPayload !== null && addUsersPayload !== undefined) { + let requestModelMapper = new client.models['AddUsersPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, addUsersPayload, 'addUsersPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(addUsersPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _register(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/register'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Labs. */ +class Labs { + /** + * Create a Labs. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._addUsers = _addUsers; + this._register = _register; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + } + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, lab, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, optionalCallback); + } + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, lab, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, lab, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, lab, options, optionalCallback); + } + } + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + addUsersWithHttpOperationResponse(resourceGroupName, labAccountName, labName, addUsersPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, optionalCallback); + } + } + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + registerWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._register(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + register(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._register(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._register(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Labs; diff --git a/lib/services/labServices/lib/operations/operations.js b/lib/services/labServices/lib/operations/operations.js new file mode 100644 index 0000000000..6ae1429a4f --- /dev/null +++ b/lib/services/labServices/lib/operations/operations.js @@ -0,0 +1,261 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(locationName, operationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (operationName === null || operationName === undefined || typeof operationName.valueOf() !== 'string') { + throw new Error('operationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{locationName}/operations/{operationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{operationName}', encodeURIComponent(operationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(locationName, operationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(locationName, operationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(locationName, operationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(locationName, operationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(locationName, operationName, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/labServices/lib/operations/providerOperations.js b/lib/services/labServices/lib/operations/providerOperations.js new file mode 100644 index 0000000000..0bbc2d4c4a --- /dev/null +++ b/lib/services/labServices/lib/operations/providerOperations.js @@ -0,0 +1,453 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ProviderOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ProviderOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ProviderOperations. */ +class ProviderOperations { + /** + * Create a ProviderOperations. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ProviderOperations; diff --git a/lib/services/labServices/lib/operations/users.js b/lib/services/labServices/lib/operations/users.js new file mode 100644 index 0000000000..c1f5532435 --- /dev/null +++ b/lib/services/labServices/lib/operations/users.js @@ -0,0 +1,1838 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; +const moment = require('moment'); + +/** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationUser']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (user === null || user === undefined) { + throw new Error('user cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (user !== null && user !== undefined) { + let requestModelMapper = new client.models['User']().mapper(); + requestModel = client.serialize(requestModelMapper, user, 'user'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(user, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, userName, user, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (user === null || user === undefined) { + throw new Error('user cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (user !== null && user !== undefined) { + let requestModelMapper = new client.models['UserFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, user, 'user'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(user, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationUser']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Users. */ +class Users { + /** + * Create a Users. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + } + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, userName, options, optionalCallback); + } + } + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, user, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback); + } + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback); + } + } + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, user, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback); + } + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback); + } + } + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Users; diff --git a/lib/services/labServices/package.json b/lib/services/labServices/package.json new file mode 100644 index 0000000000..c02779415e --- /dev/null +++ b/lib/services/labServices/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-labservices", + "author": "Microsoft Corporation", + "description": "ManagedLabsClient Library with typescript type definitions for node", + "version": "1.0.0", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/managedLabsClient.js", + "types": "./lib/managedLabsClient.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/labServices", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-node/issues" + } +} diff --git a/lib/services/labservicesManagement/LICENSE.txt b/lib/services/labservicesManagement/LICENSE.txt new file mode 100644 index 0000000000..8f3d856145 --- /dev/null +++ b/lib/services/labservicesManagement/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/labservicesManagement/README.md b/lib/services/labservicesManagement/README.md new file mode 100644 index 0000000000..f4a7dfc30b --- /dev/null +++ b/lib/services/labservicesManagement/README.md @@ -0,0 +1,43 @@ +--- +uid: azure-arm-labservices +summary: *content + +--- +**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.** +## Microsoft Azure SDK for Node.js - ManagedLabsClient + +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +### Features + + +### How to Install + +```bash +npm install azure-arm-labservices +``` + +### How to use + +#### Authentication, client creation, and list providerOperations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const ManagedLabsClient = require("azure-arm-labservices"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new ManagedLabsClient(creds, subscriptionId); + + return client.providerOperations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); +``` +### Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/labservicesManagement/lib/managedLabsClient.d.ts b/lib/services/labservicesManagement/lib/managedLabsClient.d.ts new file mode 100644 index 0000000000..ebbd6d20c1 --- /dev/null +++ b/lib/services/labservicesManagement/lib/managedLabsClient.d.ts @@ -0,0 +1,70 @@ +/* + * 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 { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class ManagedLabsClient extends AzureServiceClient { + /** + * Initializes a new instance of the ManagedLabsClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The subscription ID. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + apiVersion: string; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + providerOperations: operations.ProviderOperations; + globalUsers: operations.GlobalUsers; + labAccounts: operations.LabAccounts; + operations: operations.Operations; + galleryImages: operations.GalleryImages; + labs: operations.Labs; + environmentSettings: operations.EnvironmentSettings; + environments: operations.Environments; + users: operations.Users; +} + +export { ManagedLabsClient, models as ManagedLabsModels }; diff --git a/lib/services/labservicesManagement/lib/managedLabsClient.js b/lib/services/labservicesManagement/lib/managedLabsClient.js new file mode 100644 index 0000000000..afe39a1456 --- /dev/null +++ b/lib/services/labservicesManagement/lib/managedLabsClient.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a ManagedLabsClient. */ +class ManagedLabsClient extends ServiceClient { + /** + * Create a ManagedLabsClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The subscription ID. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2018-10-15'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.providerOperations = new operations.ProviderOperations(this); + this.globalUsers = new operations.GlobalUsers(this); + this.labAccounts = new operations.LabAccounts(this); + this.operations = new operations.Operations(this); + this.galleryImages = new operations.GalleryImages(this); + this.labs = new operations.Labs(this); + this.environmentSettings = new operations.EnvironmentSettings(this); + this.environments = new operations.Environments(this); + this.users = new operations.Users(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = ManagedLabsClient; +module.exports['default'] = ManagedLabsClient; +module.exports.ManagedLabsClient = ManagedLabsClient; +module.exports.ManagedLabsModels = models; diff --git a/lib/services/labservicesManagement/lib/models/addUsersPayload.js b/lib/services/labservicesManagement/lib/models/addUsersPayload.js new file mode 100644 index 0000000000..7e6b7de173 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/addUsersPayload.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload for Add Users operation on a Lab. + * + */ +class AddUsersPayload { + /** + * Create a AddUsersPayload. + * @property {array} emailAddresses List of user emails addresses to add to + * the lab. + */ + constructor() { + } + + /** + * Defines the metadata of AddUsersPayload + * + * @returns {object} metadata of AddUsersPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'AddUsersPayload', + type: { + name: 'Composite', + className: 'AddUsersPayload', + modelProperties: { + emailAddresses: { + required: true, + serializedName: 'emailAddresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = AddUsersPayload; diff --git a/lib/services/labservicesManagement/lib/models/createLabProperties.js b/lib/services/labservicesManagement/lib/models/createLabProperties.js new file mode 100644 index 0000000000..8a40b355f1 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/createLabProperties.js @@ -0,0 +1,122 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties for creating a managed lab and a default environment setting + * + */ +class CreateLabProperties { + /** + * Create a CreateLabProperties. + * @property {object} [environmentSettingCreationParameters] Settings related + * to creating an environment setting + * @property {object} + * [environmentSettingCreationParameters.resourceSettingCreationParameters] + * The resource specific settings + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * @property {object} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters] + * Creation parameters for Reference Vm + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName] + * The username of the virtual machine + * @property {string} + * [environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password] + * The password of the virtual machine. + * @property {object} labCreationParameters Settings related to creating a + * lab + * @property {number} [labCreationParameters.maxUsersInLab] Maximum number of + * users allowed in the lab. + * @property {string} name The name of the resource + * @property {string} [location] The location of the resource + * @property {object} [tags] The tags of the resource. + */ + constructor() { + } + + /** + * Defines the metadata of CreateLabProperties + * + * @returns {object} metadata of CreateLabProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'CreateLabProperties', + type: { + name: 'Composite', + className: 'CreateLabProperties', + modelProperties: { + environmentSettingCreationParameters: { + required: false, + serializedName: 'environmentSettingCreationParameters', + type: { + name: 'Composite', + className: 'EnvironmentSettingCreationParameters' + } + }, + labCreationParameters: { + required: true, + serializedName: 'labCreationParameters', + type: { + name: 'Composite', + className: 'LabCreationParameters' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = CreateLabProperties; diff --git a/lib/services/labservicesManagement/lib/models/environment.js b/lib/services/labservicesManagement/lib/models/environment.js new file mode 100644 index 0000000000..26e3afaff1 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environment.js @@ -0,0 +1,233 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an environment instance + * + * @extends models['Resource'] + */ +class Environment extends models['Resource'] { + /** + * Create a Environment. + * @property {object} [resourceSets] The set of a VM and the setting id it + * was created for + * @property {string} [resourceSets.vmResourceId] VM resource Id for the + * environment + * @property {string} [resourceSets.resourceSettingId] resourceSettingId for + * the environment + * @property {string} [claimedByUserObjectId] The AAD object Id of the user + * who has claimed the environment + * @property {string} [claimedByUserPrincipalId] The user principal Id of the + * user who has claimed the environment + * @property {string} [claimedByUserName] The name or email address of the + * user who has claimed the environment + * @property {boolean} [isClaimed] Is the environment claimed or not + * @property {string} [lastKnownPowerState] Last known power state of the + * environment + * @property {object} [networkInterface] Network details of the environment + * @property {string} [networkInterface.privateIpAddress] PrivateIp address + * of the Compute VM + * @property {string} [networkInterface.sshAuthority] Connection information + * for Linux + * @property {string} [networkInterface.rdpAuthority] Connection information + * for Windows + * @property {string} [networkInterface.username] Username of the VM + * @property {moment.duration} [totalUsage] How long the environment has been + * used by a lab user + * @property {date} [passwordLastReset] When the password was last reset on + * the environment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Environment + * + * @returns {object} metadata of Environment + * + */ + mapper() { + return { + required: false, + serializedName: 'Environment', + type: { + name: 'Composite', + className: 'Environment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + resourceSets: { + required: false, + serializedName: 'properties.resourceSets', + type: { + name: 'Composite', + className: 'ResourceSet' + } + }, + claimedByUserObjectId: { + required: false, + readOnly: true, + serializedName: 'properties.claimedByUserObjectId', + type: { + name: 'String' + } + }, + claimedByUserPrincipalId: { + required: false, + readOnly: true, + serializedName: 'properties.claimedByUserPrincipalId', + type: { + name: 'String' + } + }, + claimedByUserName: { + required: false, + readOnly: true, + serializedName: 'properties.claimedByUserName', + type: { + name: 'String' + } + }, + isClaimed: { + required: false, + readOnly: true, + serializedName: 'properties.isClaimed', + type: { + name: 'Boolean' + } + }, + lastKnownPowerState: { + required: false, + readOnly: true, + serializedName: 'properties.lastKnownPowerState', + type: { + name: 'String' + } + }, + networkInterface: { + required: false, + readOnly: true, + serializedName: 'properties.networkInterface', + type: { + name: 'Composite', + className: 'NetworkInterface' + } + }, + totalUsage: { + required: false, + readOnly: true, + serializedName: 'properties.totalUsage', + type: { + name: 'TimeSpan' + } + }, + passwordLastReset: { + required: false, + readOnly: true, + serializedName: 'properties.passwordLastReset', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = Environment; diff --git a/lib/services/labservicesManagement/lib/models/environmentDetails.js b/lib/services/labservicesManagement/lib/models/environmentDetails.js new file mode 100644 index 0000000000..e643801c49 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentDetails.js @@ -0,0 +1,156 @@ +/* + * 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. + */ + +'use strict'; + +/** + * This represents the details about a User's environment and its state. + * + */ +class EnvironmentDetails { + /** + * Create a EnvironmentDetails. + * @property {string} [name] Name of the Environment + * @property {string} [description] Description of the Environment + * @property {string} [id] Resource Id of the environment + * @property {string} [provisioningState] The provisioning state of the + * environment. This also includes LabIsFull and NotYetProvisioned status. + * @property {object} [virtualMachineDetails] Details of backing DTL virtual + * machine with compute and network details. + * @property {string} [virtualMachineDetails.provisioningState] Provisioning + * state of the Dtl VM + * @property {string} [virtualMachineDetails.rdpAuthority] Connection + * information for Windows + * @property {string} [virtualMachineDetails.sshAuthority] Connection + * information for Linux + * @property {string} [virtualMachineDetails.privateIpAddress] PrivateIp + * address of the compute VM + * @property {string} [virtualMachineDetails.userName] Compute VM login user + * name + * @property {string} [virtualMachineDetails.lastKnownPowerState] Last known + * compute power state captured in DTL + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + * @property {string} [environmentState] Publishing state of the environment + * setting Possible values are Creating, Created, Failed + * @property {moment.duration} [totalUsage] How long the environment has been + * used by a lab user + * @property {date} [passwordLastReset] When the password was last reset on + * the environment. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentDetails + * + * @returns {object} metadata of EnvironmentDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentDetails', + type: { + name: 'Composite', + className: 'EnvironmentDetails', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + virtualMachineDetails: { + required: false, + readOnly: true, + serializedName: 'virtualMachineDetails', + type: { + name: 'Composite', + className: 'VirtualMachineDetails' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + }, + environmentState: { + required: false, + readOnly: true, + serializedName: 'environmentState', + type: { + name: 'String' + } + }, + totalUsage: { + required: false, + readOnly: true, + serializedName: 'totalUsage', + type: { + name: 'TimeSpan' + } + }, + passwordLastReset: { + required: false, + readOnly: true, + serializedName: 'passwordLastReset', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = EnvironmentDetails; diff --git a/lib/services/labservicesManagement/lib/models/environmentFragment.js b/lib/services/labservicesManagement/lib/models/environmentFragment.js new file mode 100644 index 0000000000..e3b7398d9c --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentFragment.js @@ -0,0 +1,125 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an environment instance + * + * @extends models['Resource'] + */ +class EnvironmentFragment extends models['Resource'] { + /** + * Create a EnvironmentFragment. + * @property {object} [resourceSets] The set of a VM and the setting id it + * was created for + * @property {string} [resourceSets.vmResourceId] VM resource Id for the + * environment + * @property {string} [resourceSets.resourceSettingId] resourceSettingId for + * the environment + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EnvironmentFragment + * + * @returns {object} metadata of EnvironmentFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentFragment', + type: { + name: 'Composite', + className: 'EnvironmentFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + resourceSets: { + required: false, + serializedName: 'properties.resourceSets', + type: { + name: 'Composite', + className: 'ResourceSetFragment' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentFragment; diff --git a/lib/services/labservicesManagement/lib/models/environmentOperationsPayload.js b/lib/services/labservicesManagement/lib/models/environmentOperationsPayload.js new file mode 100644 index 0000000000..25fc4f302a --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentOperationsPayload.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents payload for any Environment operations like get, start, stop, + * connect + * + */ +class EnvironmentOperationsPayload { + /** + * Create a EnvironmentOperationsPayload. + * @property {string} environmentId The resourceId of the environment + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentOperationsPayload + * + * @returns {object} metadata of EnvironmentOperationsPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentOperationsPayload', + type: { + name: 'Composite', + className: 'EnvironmentOperationsPayload', + modelProperties: { + environmentId: { + required: true, + serializedName: 'environmentId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentOperationsPayload; diff --git a/lib/services/labservicesManagement/lib/models/environmentSetting.js b/lib/services/labservicesManagement/lib/models/environmentSetting.js new file mode 100644 index 0000000000..b7f85f7c90 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentSetting.js @@ -0,0 +1,235 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents settings of an environment, from which environment instances + * would be created + * + * @extends models['Resource'] + */ +class EnvironmentSetting extends models['Resource'] { + /** + * Create a EnvironmentSetting. + * @property {string} [publishingState] Describes the readiness of this + * environment setting. Possible values include: 'Draft', 'Publishing', + * 'Published', 'PublishFailed', 'Scaling' + * @property {string} [configurationState] Describes the user's progress in + * configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * @property {string} [description] Describes the environment and its + * resource settings + * @property {string} [title] Brief title describing the environment and its + * resource settings + * @property {object} resourceSettings The resource specific settings + * @property {string} [resourceSettings.id] The unique id of the resource + * setting + * @property {string} [resourceSettings.galleryImageResourceId] The resource + * id of the gallery image used for creating the virtual machine + * @property {string} [resourceSettings.imageName] The name of the image used + * to created the environment setting + * @property {string} [resourceSettings.size] The size of the virtual + * machine. Possible values include: 'Basic', 'Standard', 'Performance' + * @property {number} [resourceSettings.cores] The translated compute cores + * of the virtual machine + * @property {object} [resourceSettings.referenceVm] Details specific to + * Reference Vm + * @property {string} [resourceSettings.referenceVm.userName] The username of + * the virtual machine + * @property {string} [resourceSettings.referenceVm.password] The password of + * the virtual machine. This will be set to null in GET resource API + * @property {object} [resourceSettings.referenceVm.vmStateDetails] The state + * details for the reference virtual machine. + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.rdpAuthority] The + * RdpAuthority property is a server DNS host name or IP address followed by + * the service port number for RDP (Remote Desktop Protocol). + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.sshAuthority] The + * SshAuthority property is a server DNS host name or IP address followed by + * the service port number for SSH. + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.powerState] The power state + * of the reference virtual machine. + * @property {string} + * [resourceSettings.referenceVm.vmStateDetails.lastKnownPowerState] Last + * known compute power state captured in DTL + * @property {string} [resourceSettings.referenceVm.vmResourceId] VM resource + * Id for the environment + * @property {date} [lastChanged] Time when the template VM was last changed. + * @property {date} [lastPublished] Time when the template VM was last sent + * for publishing. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EnvironmentSetting + * + * @returns {object} metadata of EnvironmentSetting + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSetting', + type: { + name: 'Composite', + className: 'EnvironmentSetting', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + publishingState: { + required: false, + readOnly: true, + serializedName: 'properties.publishingState', + type: { + name: 'String' + } + }, + configurationState: { + required: false, + serializedName: 'properties.configurationState', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + title: { + required: false, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + resourceSettings: { + required: true, + serializedName: 'properties.resourceSettings', + type: { + name: 'Composite', + className: 'ResourceSettings' + } + }, + lastChanged: { + required: false, + readOnly: true, + serializedName: 'properties.lastChanged', + type: { + name: 'DateTime' + } + }, + lastPublished: { + required: false, + readOnly: true, + serializedName: 'properties.lastPublished', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSetting; diff --git a/lib/services/labservicesManagement/lib/models/environmentSettingCreationParameters.js b/lib/services/labservicesManagement/lib/models/environmentSettingCreationParameters.js new file mode 100644 index 0000000000..2ea897de75 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentSettingCreationParameters.js @@ -0,0 +1,73 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Settings related to creating an environment setting + * + */ +class EnvironmentSettingCreationParameters { + /** + * Create a EnvironmentSettingCreationParameters. + * @property {object} resourceSettingCreationParameters The resource specific + * settings + * @property {string} [resourceSettingCreationParameters.location] The + * location where the virtual machine will live + * @property {string} [resourceSettingCreationParameters.name] The name of + * the resource setting + * @property {string} + * [resourceSettingCreationParameters.galleryImageResourceId] The resource id + * of the gallery image used for creating the virtual machine + * @property {string} [resourceSettingCreationParameters.size] The size of + * the virtual machine. Possible values include: 'Basic', 'Standard', + * 'Performance' + * @property {object} + * [resourceSettingCreationParameters.referenceVmCreationParameters] Creation + * parameters for Reference Vm + * @property {string} + * [resourceSettingCreationParameters.referenceVmCreationParameters.userName] + * The username of the virtual machine + * @property {string} + * [resourceSettingCreationParameters.referenceVmCreationParameters.password] + * The password of the virtual machine. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentSettingCreationParameters + * + * @returns {object} metadata of EnvironmentSettingCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSettingCreationParameters', + type: { + name: 'Composite', + className: 'EnvironmentSettingCreationParameters', + modelProperties: { + resourceSettingCreationParameters: { + required: true, + serializedName: 'resourceSettingCreationParameters', + type: { + name: 'Composite', + className: 'ResourceSettingCreationParameters' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSettingCreationParameters; diff --git a/lib/services/labservicesManagement/lib/models/environmentSettingFragment.js b/lib/services/labservicesManagement/lib/models/environmentSettingFragment.js new file mode 100644 index 0000000000..7caa42cdd9 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentSettingFragment.js @@ -0,0 +1,159 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents settings of an environment, from which environment instances + * would be created + * + * @extends models['Resource'] + */ +class EnvironmentSettingFragment extends models['Resource'] { + /** + * Create a EnvironmentSettingFragment. + * @property {string} [configurationState] Describes the user's progress in + * configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * @property {string} [description] Describes the environment and its + * resource settings + * @property {string} [title] Brief title describing the environment and its + * resource settings + * @property {object} [resourceSettings] The resource specific settings + * @property {string} [resourceSettings.galleryImageResourceId] The resource + * id of the gallery image used for creating the virtual machine + * @property {string} [resourceSettings.size] The size of the virtual + * machine. Possible values include: 'Basic', 'Standard', 'Performance' + * @property {object} [resourceSettings.referenceVm] Details specific to + * Reference Vm + * @property {string} [resourceSettings.referenceVm.userName] The username of + * the virtual machine + * @property {string} [resourceSettings.referenceVm.password] The password of + * the virtual machine. This will be set to null in GET resource API + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EnvironmentSettingFragment + * + * @returns {object} metadata of EnvironmentSettingFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSettingFragment', + type: { + name: 'Composite', + className: 'EnvironmentSettingFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + configurationState: { + required: false, + serializedName: 'properties.configurationState', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + title: { + required: false, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + resourceSettings: { + required: false, + serializedName: 'properties.resourceSettings', + type: { + name: 'Composite', + className: 'ResourceSettingsFragment' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSettingFragment; diff --git a/lib/services/labservicesManagement/lib/models/environmentSize.js b/lib/services/labservicesManagement/lib/models/environmentSize.js new file mode 100644 index 0000000000..3b9fcb28fe --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentSize.js @@ -0,0 +1,103 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a size category supported by this Lab Account (small, medium or + * large) + * + */ +class EnvironmentSize { + /** + * Create a EnvironmentSize. + * @property {string} [name] The size category. Possible values include: + * 'Basic', 'Standard', 'Performance' + * @property {array} [vmSizes] Represents a set of compute sizes that can + * serve this given size type + * @property {number} [maxPrice] The pay-as-you-go dollar price per hour this + * size will cost. It does not include discounts and may not reflect the + * actual price the size will cost. This is the maximum price of all prices + * within this tier. + * @property {number} [minNumberOfCores] The number of cores a VM of this + * size has. This is the minimum number of cores within this tier. + * @property {number} [minMemory] The amount of memory available (in GB). + * This is the minimum amount of memory within this tier. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentSize + * + * @returns {object} metadata of EnvironmentSize + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSize', + type: { + name: 'Composite', + className: 'EnvironmentSize', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + vmSizes: { + required: false, + serializedName: 'vmSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SizeInfoElementType', + type: { + name: 'Composite', + className: 'SizeInfo' + } + } + } + }, + maxPrice: { + required: false, + readOnly: true, + serializedName: 'maxPrice', + type: { + name: 'Number' + } + }, + minNumberOfCores: { + required: false, + readOnly: true, + serializedName: 'minNumberOfCores', + type: { + name: 'Number' + } + }, + minMemory: { + required: false, + readOnly: true, + serializedName: 'minMemory', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = EnvironmentSize; diff --git a/lib/services/labservicesManagement/lib/models/environmentSizeFragment.js b/lib/services/labservicesManagement/lib/models/environmentSizeFragment.js new file mode 100644 index 0000000000..c00cef8e55 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/environmentSizeFragment.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a size category supported by this Lab Account (small, medium or + * large) + * + */ +class EnvironmentSizeFragment { + /** + * Create a EnvironmentSizeFragment. + * @property {string} [name] The size category. Possible values include: + * 'Basic', 'Standard', 'Performance' + * @property {array} [vmSizes] Represents a set of compute sizes that can + * serve this given size type + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentSizeFragment + * + * @returns {object} metadata of EnvironmentSizeFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentSizeFragment', + type: { + name: 'Composite', + className: 'EnvironmentSizeFragment', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + vmSizes: { + required: false, + serializedName: 'vmSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SizeInfoFragmentElementType', + type: { + name: 'Composite', + className: 'SizeInfoFragment' + } + } + } + } + } + } + }; + } +} + +module.exports = EnvironmentSizeFragment; diff --git a/lib/services/labservicesManagement/lib/models/galleryImage.js b/lib/services/labservicesManagement/lib/models/galleryImage.js new file mode 100644 index 0000000000..95d158b30a --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/galleryImage.js @@ -0,0 +1,225 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an image from the Azure Marketplace + * + * @extends models['Resource'] + */ +class GalleryImage extends models['Resource'] { + /** + * Create a GalleryImage. + * @property {string} [author] The author of the gallery image. + * @property {date} [createdDate] The creation date of the gallery image. + * @property {string} [description] The description of the gallery image. + * @property {object} [imageReference] The image reference of the gallery + * image. + * @property {string} [imageReference.offer] The offer of the gallery image. + * @property {string} [imageReference.publisher] The publisher of the gallery + * image. + * @property {string} [imageReference.sku] The SKU of the gallery image. + * @property {string} [imageReference.osType] The OS type of the gallery + * image. + * @property {string} [imageReference.version] The version of the gallery + * image. + * @property {string} [icon] The icon of the gallery image. + * @property {boolean} [isEnabled] Indicates whether this gallery image is + * enabled. + * @property {boolean} [isOverride] Indicates whether this gallery has been + * overridden for this lab account + * @property {string} [planId] The third party plan that applies to this + * image + * @property {boolean} [isPlanAuthorized] Indicates if the plan has been + * authorized for programmatic deployment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of GalleryImage + * + * @returns {object} metadata of GalleryImage + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImage', + type: { + name: 'Composite', + className: 'GalleryImage', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + author: { + required: false, + readOnly: true, + serializedName: 'properties.author', + type: { + name: 'String' + } + }, + createdDate: { + required: false, + readOnly: true, + serializedName: 'properties.createdDate', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + imageReference: { + required: false, + readOnly: true, + serializedName: 'properties.imageReference', + type: { + name: 'Composite', + className: 'GalleryImageReference' + } + }, + icon: { + required: false, + readOnly: true, + serializedName: 'properties.icon', + type: { + name: 'String' + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + isOverride: { + required: false, + serializedName: 'properties.isOverride', + type: { + name: 'Boolean' + } + }, + planId: { + required: false, + readOnly: true, + serializedName: 'properties.planId', + type: { + name: 'String' + } + }, + isPlanAuthorized: { + required: false, + serializedName: 'properties.isPlanAuthorized', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = GalleryImage; diff --git a/lib/services/labservicesManagement/lib/models/galleryImageFragment.js b/lib/services/labservicesManagement/lib/models/galleryImageFragment.js new file mode 100644 index 0000000000..38d4eb6657 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/galleryImageFragment.js @@ -0,0 +1,138 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents an image from the Azure Marketplace + * + * @extends models['Resource'] + */ +class GalleryImageFragment extends models['Resource'] { + /** + * Create a GalleryImageFragment. + * @property {boolean} [isEnabled] Indicates whether this gallery image is + * enabled. + * @property {boolean} [isOverride] Indicates whether this gallery has been + * overridden for this lab account + * @property {boolean} [isPlanAuthorized] Indicates if the plan has been + * authorized for programmatic deployment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of GalleryImageFragment + * + * @returns {object} metadata of GalleryImageFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImageFragment', + type: { + name: 'Composite', + className: 'GalleryImageFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + isOverride: { + required: false, + serializedName: 'properties.isOverride', + type: { + name: 'Boolean' + } + }, + isPlanAuthorized: { + required: false, + serializedName: 'properties.isPlanAuthorized', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GalleryImageFragment; diff --git a/lib/services/labservicesManagement/lib/models/galleryImageReference.js b/lib/services/labservicesManagement/lib/models/galleryImageReference.js new file mode 100644 index 0000000000..b06982e70d --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/galleryImageReference.js @@ -0,0 +1,84 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The reference information for an Azure Marketplace image. + * + */ +class GalleryImageReference { + /** + * Create a GalleryImageReference. + * @property {string} [offer] The offer of the gallery image. + * @property {string} [publisher] The publisher of the gallery image. + * @property {string} [sku] The SKU of the gallery image. + * @property {string} [osType] The OS type of the gallery image. + * @property {string} [version] The version of the gallery image. + */ + constructor() { + } + + /** + * Defines the metadata of GalleryImageReference + * + * @returns {object} metadata of GalleryImageReference + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImageReference', + type: { + name: 'Composite', + className: 'GalleryImageReference', + modelProperties: { + offer: { + required: false, + serializedName: 'offer', + type: { + name: 'String' + } + }, + publisher: { + required: false, + serializedName: 'publisher', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'String' + } + }, + osType: { + required: false, + serializedName: 'osType', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GalleryImageReference; diff --git a/lib/services/labservicesManagement/lib/models/galleryImageReferenceFragment.js b/lib/services/labservicesManagement/lib/models/galleryImageReferenceFragment.js new file mode 100644 index 0000000000..f7bfa406ed --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/galleryImageReferenceFragment.js @@ -0,0 +1,84 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The reference information for an Azure Marketplace image. + * + */ +class GalleryImageReferenceFragment { + /** + * Create a GalleryImageReferenceFragment. + * @property {string} [offer] The offer of the gallery image. + * @property {string} [publisher] The publisher of the gallery image. + * @property {string} [sku] The SKU of the gallery image. + * @property {string} [osType] The OS type of the gallery image. + * @property {string} [version] The version of the gallery image. + */ + constructor() { + } + + /** + * Defines the metadata of GalleryImageReferenceFragment + * + * @returns {object} metadata of GalleryImageReferenceFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'GalleryImageReferenceFragment', + type: { + name: 'Composite', + className: 'GalleryImageReferenceFragment', + modelProperties: { + offer: { + required: false, + serializedName: 'offer', + type: { + name: 'String' + } + }, + publisher: { + required: false, + serializedName: 'publisher', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'String' + } + }, + osType: { + required: false, + serializedName: 'osType', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GalleryImageReferenceFragment; diff --git a/lib/services/labservicesManagement/lib/models/getEnvironmentResponse.js b/lib/services/labservicesManagement/lib/models/getEnvironmentResponse.js new file mode 100644 index 0000000000..ad106420d8 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/getEnvironmentResponse.js @@ -0,0 +1,95 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the environments details + * + */ +class GetEnvironmentResponse { + /** + * Create a GetEnvironmentResponse. + * @property {object} [environment] Details of the environment + * @property {string} [environment.name] Name of the Environment + * @property {string} [environment.description] Description of the + * Environment + * @property {string} [environment.id] Resource Id of the environment + * @property {string} [environment.provisioningState] The provisioning state + * of the environment. This also includes LabIsFull and NotYetProvisioned + * status. + * @property {object} [environment.virtualMachineDetails] Details of backing + * DTL virtual machine with compute and network details. + * @property {string} [environment.virtualMachineDetails.provisioningState] + * Provisioning state of the Dtl VM + * @property {string} [environment.virtualMachineDetails.rdpAuthority] + * Connection information for Windows + * @property {string} [environment.virtualMachineDetails.sshAuthority] + * Connection information for Linux + * @property {string} [environment.virtualMachineDetails.privateIpAddress] + * PrivateIp address of the compute VM + * @property {string} [environment.virtualMachineDetails.userName] Compute VM + * login user name + * @property {string} [environment.virtualMachineDetails.lastKnownPowerState] + * Last known compute power state captured in DTL + * @property {object} [environment.latestOperationResult] The details of the + * latest operation. ex: status, error + * @property {string} [environment.latestOperationResult.status] The current + * status of the operation. + * @property {string} [environment.latestOperationResult.errorCode] Error + * code on failure. + * @property {string} [environment.latestOperationResult.errorMessage] The + * error message. + * @property {string} [environment.latestOperationResult.requestUri] Request + * URI of the operation. + * @property {string} [environment.latestOperationResult.httpMethod] The + * HttpMethod - PUT/POST/DELETE for the operation. + * @property {string} [environment.latestOperationResult.operationUrl] The + * URL to use to check long-running operation status + * @property {string} [environment.environmentState] Publishing state of the + * environment setting Possible values are Creating, Created, Failed + * @property {moment.duration} [environment.totalUsage] How long the + * environment has been used by a lab user + * @property {date} [environment.passwordLastReset] When the password was + * last reset on the environment. + */ + constructor() { + } + + /** + * Defines the metadata of GetEnvironmentResponse + * + * @returns {object} metadata of GetEnvironmentResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'GetEnvironmentResponse', + type: { + name: 'Composite', + className: 'GetEnvironmentResponse', + modelProperties: { + environment: { + required: false, + readOnly: true, + serializedName: 'environment', + type: { + name: 'Composite', + className: 'EnvironmentDetails' + } + } + } + } + }; + } +} + +module.exports = GetEnvironmentResponse; diff --git a/lib/services/labservicesManagement/lib/models/getPersonalPreferencesResponse.js b/lib/services/labservicesManagement/lib/models/getPersonalPreferencesResponse.js new file mode 100644 index 0000000000..ea2e08dacb --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/getPersonalPreferencesResponse.js @@ -0,0 +1,68 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the PersonalPreferences for the user + * + */ +class GetPersonalPreferencesResponse { + /** + * Create a GetPersonalPreferencesResponse. + * @property {string} [id] Id to be used by the cache orchestrator + * @property {array} [favoriteLabResourceIds] Array of favorite lab resource + * ids + */ + constructor() { + } + + /** + * Defines the metadata of GetPersonalPreferencesResponse + * + * @returns {object} metadata of GetPersonalPreferencesResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'GetPersonalPreferencesResponse', + type: { + name: 'Composite', + className: 'GetPersonalPreferencesResponse', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + favoriteLabResourceIds: { + required: false, + serializedName: 'favoriteLabResourceIds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = GetPersonalPreferencesResponse; diff --git a/lib/services/labservicesManagement/lib/models/getRegionalAvailabilityResponse.js b/lib/services/labservicesManagement/lib/models/getRegionalAvailabilityResponse.js new file mode 100644 index 0000000000..cb9d915c39 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/getRegionalAvailabilityResponse.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response model from the GetRegionalAvailability action + * + */ +class GetRegionalAvailabilityResponse { + /** + * Create a GetRegionalAvailabilityResponse. + * @property {array} [regionalAvailability] Availability information for + * different size categories per region + */ + constructor() { + } + + /** + * Defines the metadata of GetRegionalAvailabilityResponse + * + * @returns {object} metadata of GetRegionalAvailabilityResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'GetRegionalAvailabilityResponse', + type: { + name: 'Composite', + className: 'GetRegionalAvailabilityResponse', + modelProperties: { + regionalAvailability: { + required: false, + serializedName: 'regionalAvailability', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RegionalAvailabilityElementType', + type: { + name: 'Composite', + className: 'RegionalAvailability' + } + } + } + } + } + } + }; + } +} + +module.exports = GetRegionalAvailabilityResponse; diff --git a/lib/services/labservicesManagement/lib/models/index.d.ts b/lib/services/labservicesManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..057c5906ff --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/index.d.ts @@ -0,0 +1,1335 @@ +/* + * 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 { BaseResource, CloudError } from "ms-rest-azure"; +import * as moment from "moment"; + +export { + + BaseResource, + CloudError +}; + +/** + * Payload for Add Users operation on a Lab. + */ +export interface AddUsersPayload { + /** + * List of user emails addresses to add to the lab. + */ + emailAddresses: string[]; +} + +/** + * Creation parameters for Reference Vm + */ +export interface ReferenceVmCreationParameters { + /** + * The username of the virtual machine + */ + userName: string; + /** + * The password of the virtual machine. + */ + password: string; +} + +/** + * Represents resource specific settings + */ +export interface ResourceSettingCreationParameters { + /** + * The location where the virtual machine will live + */ + location?: string; + /** + * The name of the resource setting + */ + name?: string; + /** + * The resource id of the gallery image used for creating the virtual machine + */ + galleryImageResourceId: string; + /** + * The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + */ + size?: string; + /** + * Creation parameters for Reference Vm + */ + referenceVmCreationParameters: ReferenceVmCreationParameters; +} + +/** + * Settings related to creating an environment setting + */ +export interface EnvironmentSettingCreationParameters { + /** + * The resource specific settings + */ + resourceSettingCreationParameters: ResourceSettingCreationParameters; +} + +/** + * Settings related to creating a lab + */ +export interface LabCreationParameters { + /** + * Maximum number of users allowed in the lab. + */ + maxUsersInLab?: number; +} + +/** + * Properties for creating a managed lab and a default environment setting + */ +export interface CreateLabProperties { + /** + * Settings related to creating an environment setting + */ + environmentSettingCreationParameters?: EnvironmentSettingCreationParameters; + /** + * Settings related to creating a lab + */ + labCreationParameters: LabCreationParameters; + /** + * The name of the resource + */ + name: string; + /** + * The location of the resource + */ + location?: string; + /** + * The tags of the resource. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * Represents a VM and the setting Id it was created for. + */ +export interface ResourceSet { + /** + * VM resource Id for the environment + */ + vmResourceId?: string; + /** + * resourceSettingId for the environment + */ + resourceSettingId?: string; +} + +/** + * Network details of the environment + */ +export interface NetworkInterface { + /** + * PrivateIp address of the Compute VM + */ + readonly privateIpAddress?: string; + /** + * Connection information for Linux + */ + readonly sshAuthority?: string; + /** + * Connection information for Windows + */ + readonly rdpAuthority?: string; + /** + * Username of the VM + */ + readonly username?: string; +} + +/** + * Details of the status of an operation. + */ +export interface LatestOperationResult { + /** + * The current status of the operation. + */ + readonly status?: string; + /** + * Error code on failure. + */ + readonly errorCode?: string; + /** + * The error message. + */ + readonly errorMessage?: string; + /** + * Request URI of the operation. + */ + readonly requestUri?: string; + /** + * The HttpMethod - PUT/POST/DELETE for the operation. + */ + readonly httpMethod?: string; + /** + * The URL to use to check long-running operation status + */ + readonly operationUrl?: string; +} + +/** + * An Azure resource. + */ +export interface Resource extends BaseResource { + /** + * The identifier of the resource. + */ + readonly id?: string; + /** + * The name of the resource. + */ + readonly name?: string; + /** + * The type of the resource. + */ + readonly type?: string; + /** + * The location of the resource. + */ + location?: string; + /** + * The tags of the resource. + */ + tags?: { [propertyName: string]: string }; +} + +/** + * Represents an environment instance + */ +export interface Environment extends Resource { + /** + * The set of a VM and the setting id it was created for + */ + resourceSets?: ResourceSet; + /** + * The AAD object Id of the user who has claimed the environment + */ + readonly claimedByUserObjectId?: string; + /** + * The user principal Id of the user who has claimed the environment + */ + readonly claimedByUserPrincipalId?: string; + /** + * The name or email address of the user who has claimed the environment + */ + readonly claimedByUserName?: string; + /** + * Is the environment claimed or not + */ + readonly isClaimed?: boolean; + /** + * Last known power state of the environment + */ + readonly lastKnownPowerState?: string; + /** + * Network details of the environment + */ + readonly networkInterface?: NetworkInterface; + /** + * How long the environment has been used by a lab user + */ + readonly totalUsage?: moment.Duration; + /** + * When the password was last reset on the environment. + */ + readonly passwordLastReset?: Date; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Details of the backing virtual machine. + */ +export interface VirtualMachineDetails { + /** + * Provisioning state of the Dtl VM + */ + readonly provisioningState?: string; + /** + * Connection information for Windows + */ + readonly rdpAuthority?: string; + /** + * Connection information for Linux + */ + readonly sshAuthority?: string; + /** + * PrivateIp address of the compute VM + */ + readonly privateIpAddress?: string; + /** + * Compute VM login user name + */ + readonly userName?: string; + /** + * Last known compute power state captured in DTL + */ + readonly lastKnownPowerState?: string; +} + +/** + * This represents the details about a User's environment and its state. + */ +export interface EnvironmentDetails { + /** + * Name of the Environment + */ + readonly name?: string; + /** + * Description of the Environment + */ + readonly description?: string; + /** + * Resource Id of the environment + */ + readonly id?: string; + /** + * The provisioning state of the environment. This also includes LabIsFull and NotYetProvisioned + * status. + */ + readonly provisioningState?: string; + /** + * Details of backing DTL virtual machine with compute and network details. + */ + readonly virtualMachineDetails?: VirtualMachineDetails; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; + /** + * Publishing state of the environment setting Possible values are Creating, Created, Failed + */ + readonly environmentState?: string; + /** + * How long the environment has been used by a lab user + */ + readonly totalUsage?: moment.Duration; + /** + * When the password was last reset on the environment. + */ + readonly passwordLastReset?: Date; +} + +/** + * Represents a VM and the setting Id it was created for. + */ +export interface ResourceSetFragment { + /** + * VM resource Id for the environment + */ + vmResourceId?: string; + /** + * resourceSettingId for the environment + */ + resourceSettingId?: string; +} + +/** + * Represents an environment instance + */ +export interface EnvironmentFragment extends Resource { + /** + * The set of a VM and the setting id it was created for + */ + resourceSets?: ResourceSetFragment; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Represents payload for any Environment operations like get, start, stop, connect + */ +export interface EnvironmentOperationsPayload { + /** + * The resourceId of the environment + */ + environmentId: string; +} + +/** + * Details about the state of the reference virtual machine. + */ +export interface VmStateDetails { + /** + * The RdpAuthority property is a server DNS host name or IP address followed by the service port + * number for RDP (Remote Desktop Protocol). + */ + readonly rdpAuthority?: string; + /** + * The SshAuthority property is a server DNS host name or IP address followed by the service port + * number for SSH. + */ + readonly sshAuthority?: string; + /** + * The power state of the reference virtual machine. + */ + readonly powerState?: string; + /** + * Last known compute power state captured in DTL + */ + readonly lastKnownPowerState?: string; +} + +/** + * Details of a Reference Vm + */ +export interface ReferenceVm { + /** + * The username of the virtual machine + */ + userName: string; + /** + * The password of the virtual machine. This will be set to null in GET resource API + */ + password?: string; + /** + * The state details for the reference virtual machine. + */ + readonly vmStateDetails?: VmStateDetails; + /** + * VM resource Id for the environment + */ + readonly vmResourceId?: string; +} + +/** + * Represents resource specific settings + */ +export interface ResourceSettings { + /** + * The unique id of the resource setting + */ + readonly id?: string; + /** + * The resource id of the gallery image used for creating the virtual machine + */ + galleryImageResourceId?: string; + /** + * The name of the image used to created the environment setting + */ + readonly imageName?: string; + /** + * The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + */ + size?: string; + /** + * The translated compute cores of the virtual machine + */ + readonly cores?: number; + /** + * Details specific to Reference Vm + */ + referenceVm: ReferenceVm; +} + +/** + * Represents settings of an environment, from which environment instances would be created + */ +export interface EnvironmentSetting extends Resource { + /** + * Describes the readiness of this environment setting. Possible values include: 'Draft', + * 'Publishing', 'Published', 'PublishFailed', 'Scaling' + */ + readonly publishingState?: string; + /** + * Describes the user's progress in configuring their environment setting. Possible values + * include: 'NotApplicable', 'Completed' + */ + configurationState?: string; + /** + * Describes the environment and its resource settings + */ + description?: string; + /** + * Brief title describing the environment and its resource settings + */ + title?: string; + /** + * The resource specific settings + */ + resourceSettings: ResourceSettings; + /** + * Time when the template VM was last changed. + */ + readonly lastChanged?: Date; + /** + * Time when the template VM was last sent for publishing. + */ + readonly lastPublished?: Date; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Details of a Reference Vm + */ +export interface ReferenceVmFragment { + /** + * The username of the virtual machine + */ + userName?: string; + /** + * The password of the virtual machine. This will be set to null in GET resource API + */ + password?: string; +} + +/** + * Represents resource specific settings + */ +export interface ResourceSettingsFragment { + /** + * The resource id of the gallery image used for creating the virtual machine + */ + galleryImageResourceId?: string; + /** + * The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + */ + size?: string; + /** + * Details specific to Reference Vm + */ + referenceVm?: ReferenceVmFragment; +} + +/** + * Represents settings of an environment, from which environment instances would be created + */ +export interface EnvironmentSettingFragment extends Resource { + /** + * Describes the user's progress in configuring their environment setting. Possible values + * include: 'NotApplicable', 'Completed' + */ + configurationState?: string; + /** + * Describes the environment and its resource settings + */ + description?: string; + /** + * Brief title describing the environment and its resource settings + */ + title?: string; + /** + * The resource specific settings + */ + resourceSettings?: ResourceSettingsFragment; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Contains detailed information about a size + */ +export interface SizeInfo { + /** + * Represents the actual compute size, e.g. Standard_A2_v2. + */ + computeSize?: string; + /** + * The pay-as-you-go price per hour this size will cost. It does not include discounts and may + * not reflect the actual price the size will cost. + */ + price?: number; + /** + * The number of cores a VM of this size has. + */ + numberOfCores?: number; + /** + * The amount of memory available (in GB). + */ + memory?: number; +} + +/** + * Represents a size category supported by this Lab Account (small, medium or large) + */ +export interface EnvironmentSize { + /** + * The size category. Possible values include: 'Basic', 'Standard', 'Performance' + */ + name?: string; + /** + * Represents a set of compute sizes that can serve this given size type + */ + vmSizes?: SizeInfo[]; + /** + * The pay-as-you-go dollar price per hour this size will cost. It does not include discounts and + * may not reflect the actual price the size will cost. This is the maximum price of all prices + * within this tier. + */ + readonly maxPrice?: number; + /** + * The number of cores a VM of this size has. This is the minimum number of cores within this + * tier. + */ + readonly minNumberOfCores?: number; + /** + * The amount of memory available (in GB). This is the minimum amount of memory within this tier. + */ + readonly minMemory?: number; +} + +/** + * Contains detailed information about a size + */ +export interface SizeInfoFragment { + /** + * Represents the actual compute size, e.g. Standard_A2_v2. + */ + computeSize?: string; + /** + * The pay-as-you-go price per hour this size will cost. It does not include discounts and may + * not reflect the actual price the size will cost. + */ + price?: number; + /** + * The number of cores a VM of this size has. + */ + numberOfCores?: number; + /** + * The amount of memory available (in GB). + */ + memory?: number; +} + +/** + * Represents a size category supported by this Lab Account (small, medium or large) + */ +export interface EnvironmentSizeFragment { + /** + * The size category. Possible values include: 'Basic', 'Standard', 'Performance' + */ + name?: string; + /** + * Represents a set of compute sizes that can serve this given size type + */ + vmSizes?: SizeInfoFragment[]; +} + +/** + * The reference information for an Azure Marketplace image. + */ +export interface GalleryImageReference { + /** + * The offer of the gallery image. + */ + offer?: string; + /** + * The publisher of the gallery image. + */ + publisher?: string; + /** + * The SKU of the gallery image. + */ + sku?: string; + /** + * The OS type of the gallery image. + */ + osType?: string; + /** + * The version of the gallery image. + */ + version?: string; +} + +/** + * Represents an image from the Azure Marketplace + */ +export interface GalleryImage extends Resource { + /** + * The author of the gallery image. + */ + readonly author?: string; + /** + * The creation date of the gallery image. + */ + readonly createdDate?: Date; + /** + * The description of the gallery image. + */ + readonly description?: string; + /** + * The image reference of the gallery image. + */ + readonly imageReference?: GalleryImageReference; + /** + * The icon of the gallery image. + */ + readonly icon?: string; + /** + * Indicates whether this gallery image is enabled. + */ + isEnabled?: boolean; + /** + * Indicates whether this gallery has been overridden for this lab account + */ + isOverride?: boolean; + /** + * The third party plan that applies to this image + */ + readonly planId?: string; + /** + * Indicates if the plan has been authorized for programmatic deployment. + */ + isPlanAuthorized?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Represents an image from the Azure Marketplace + */ +export interface GalleryImageFragment extends Resource { + /** + * Indicates whether this gallery image is enabled. + */ + isEnabled?: boolean; + /** + * Indicates whether this gallery has been overridden for this lab account + */ + isOverride?: boolean; + /** + * Indicates if the plan has been authorized for programmatic deployment. + */ + isPlanAuthorized?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * The reference information for an Azure Marketplace image. + */ +export interface GalleryImageReferenceFragment { + /** + * The offer of the gallery image. + */ + offer?: string; + /** + * The publisher of the gallery image. + */ + publisher?: string; + /** + * The SKU of the gallery image. + */ + sku?: string; + /** + * The OS type of the gallery image. + */ + osType?: string; + /** + * The version of the gallery image. + */ + version?: string; +} + +/** + * Represents the environments details + */ +export interface GetEnvironmentResponse { + /** + * Details of the environment + */ + readonly environment?: EnvironmentDetails; +} + +/** + * Represents the PersonalPreferences for the user + */ +export interface GetPersonalPreferencesResponse { + /** + * Id to be used by the cache orchestrator + */ + id?: string; + /** + * Array of favorite lab resource ids + */ + favoriteLabResourceIds?: string[]; +} + +/** + * Represents the size information + */ +export interface SizeAvailability { + /** + * The category of the size (Basic, Standard, Performance). Possible values include: 'Basic', + * 'Standard', 'Performance' + */ + sizeCategory?: string; + /** + * Whether or not this size category is available + */ + isAvailable?: boolean; +} + +/** + * The availability information of sizes across regions + */ +export interface RegionalAvailability { + /** + * Corresponding region + */ + region?: string; + /** + * List of all the size information for the region + */ + sizeAvailabilities?: SizeAvailability[]; +} + +/** + * The response model from the GetRegionalAvailability action + */ +export interface GetRegionalAvailabilityResponse { + /** + * Availability information for different size categories per region + */ + regionalAvailability?: RegionalAvailability[]; +} + +/** + * Represents a lab. + */ +export interface Lab extends Resource { + /** + * Maximum number of users allowed in the lab. + */ + maxUsersInLab?: number; + /** + * Maximum value MaxUsersInLab can be set to, as specified by the service + */ + readonly userQuota?: number; + /** + * Invitation code that users can use to join a lab. + */ + readonly invitationCode?: string; + /** + * Object id of the user that created the lab. + */ + readonly createdByObjectId?: string; + /** + * Maximum duration a user can use an environment for in the lab. + */ + usageQuota?: moment.Duration; + /** + * Lab user access mode (open to all vs. restricted to those listed on the lab). Possible values + * include: 'Restricted', 'Open' + */ + userAccessMode?: string; + /** + * Lab creator name + */ + readonly createdByUserPrincipalName?: string; + /** + * Creation date for the lab + */ + readonly createdDate?: Date; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Represents the size configuration under the lab account + */ +export interface SizeConfigurationProperties { + /** + * Represents a list of size categories supported by this Lab Account (Small, Medium, Large) + */ + environmentSizes?: EnvironmentSize[]; +} + +/** + * Represents a lab account. + */ +export interface LabAccount extends Resource { + /** + * Represents the size configuration under the lab account + */ + readonly sizeConfiguration?: SizeConfigurationProperties; + /** + * Represents if region selection is enabled + */ + enabledRegionSelection?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * Represents a lab account. + */ +export interface LabAccountFragment extends Resource { + /** + * Represents if region selection is enabled + */ + enabledRegionSelection?: boolean; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * This represents the details about a lab that the User is in, and its state. + */ +export interface LabDetails { + /** + * Name of the lab + */ + name?: string; + /** + * The provisioning state of the lab. + */ + provisioningState?: string; + /** + * The Id of the lab. + */ + id?: string; + /** + * The maximum duration a user can use a VM in this lab. + */ + readonly usageQuota?: moment.Duration; +} + +/** + * Represents a lab. + */ +export interface LabFragment extends Resource { + /** + * Maximum number of users allowed in the lab. + */ + maxUsersInLab?: number; + /** + * Maximum duration a user can use an environment for in the lab. + */ + usageQuota?: moment.Duration; + /** + * Lab user access mode (open to all vs. restricted to those listed on the lab). Possible values + * include: 'Restricted', 'Open' + */ + userAccessMode?: string; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Represents the payload to list environments owned by a user + */ +export interface ListEnvironmentsPayload { + /** + * The resource Id of the lab + */ + labId?: string; +} + +/** + * Represents the list of environments owned by a user + */ +export interface ListEnvironmentsResponse { + /** + * List of all the environments + */ + environments?: EnvironmentDetails[]; +} + +/** + * Lists the labs owned by a user + */ +export interface ListLabsResponse { + /** + * List of all the labs + */ + labs?: LabDetails[]; +} + +/** + * Payload to get the status of an operation + */ +export interface OperationBatchStatusPayload { + /** + * The operation url of long running operation + */ + urls: string[]; +} + +/** + * Represents the status of an operation that used the batch API. + */ +export interface OperationBatchStatusResponseItem { + /** + * status of the long running operation for an environment + */ + readonly operationUrl?: string; + /** + * status of the long running operation for an environment + */ + readonly status?: string; +} + +/** + * Status Details of the long running operation for an environment + */ +export interface OperationBatchStatusResponse { + /** + * Gets a collection of items that contain the operation url and status. + */ + readonly items?: OperationBatchStatusResponseItem[]; +} + +/** + * Error details for the operation in case of a failure. + */ +export interface OperationError { + /** + * The error code of the operation error. + */ + code?: string; + /** + * The error message of the operation error. + */ + message?: string; +} + +/** + * The object that describes the operations + */ +export interface OperationMetadataDisplay { + /** + * Friendly name of the resource provider + */ + provider?: string; + /** + * Resource type on which the operation is performed. + */ + resource?: string; + /** + * Operation type: read, write, delete, listKeys/action, etc. + */ + operation?: string; + /** + * Friendly name of the operation + */ + description?: string; +} + +/** + * The REST API operation supported by ManagedLab ResourceProvider. + */ +export interface OperationMetadata { + /** + * Operation name: {provider}/{resource}/{operation} + */ + name?: string; + /** + * The object that describes the operations + */ + display?: OperationMetadataDisplay; +} + +/** + * An Operation Result + */ +export interface OperationResult { + /** + * The operation status. + */ + status?: string; + /** + * Error details for the operation in case of a failure. + */ + error?: OperationError; +} + +/** + * Payload to get the status of an operation + */ +export interface OperationStatusPayload { + /** + * The operation url of long running operation + */ + operationUrl: string; +} + +/** + * Status Details of the long running operation for an environment + */ +export interface OperationStatusResponse { + /** + * status of the long running operation for an environment + */ + readonly status?: string; +} + +/** + * Represents payload for any Environment operations like get, start, stop, connect + */ +export interface PersonalPreferencesOperationsPayload { + /** + * Resource Id of the lab account + */ + labAccountResourceId?: string; + /** + * Enum indicating if user is adding or removing a favorite lab. Possible values include: 'Add', + * 'Remove' + */ + addRemove?: string; + /** + * Resource Id of the lab to add/remove from the favorites list + */ + labResourceId?: string; +} + +/** + * Payload for Publish operation on EnvironmentSetting. + */ +export interface PublishPayload { + /** + * Whether to use existing VM custom image when publishing. + */ + useExistingImage?: boolean; +} + +/** + * Represents payload for Register action. + */ +export interface RegisterPayload { + /** + * The registration code of the lab. + */ + registrationCode?: string; +} + +/** + * Represents the payload for resetting passwords. + */ +export interface ResetPasswordPayload { + /** + * The resourceId of the environment + */ + environmentId: string; + /** + * The username for which the password will be reset. + */ + username?: string; + /** + * The password to assign to the user specified in + */ + password?: string; +} + +/** + * Represents the size configuration under the lab account + */ +export interface SizeConfigurationPropertiesFragment { + /** + * Represents a list of size categories supported by this Lab Account (Small, Medium, Large) + */ + environmentSizes?: EnvironmentSizeFragment[]; +} + +/** + * The User registered to a lab + */ +export interface User extends Resource { + /** + * The user email address, as it was specified during registration. + */ + readonly email?: string; + /** + * The user family name, as it was specified during registration. + */ + readonly familyName?: string; + /** + * The user given name, as it was specified during registration. + */ + readonly givenName?: string; + /** + * The user tenant ID, as it was specified during registration. + */ + readonly tenantId?: string; + /** + * How long the user has used his VMs in this lab + */ + readonly totalUsage?: moment.Duration; + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; + /** + * The details of the latest operation. ex: status, error + */ + readonly latestOperationResult?: LatestOperationResult; +} + +/** + * The User registered to a lab + */ +export interface UserFragment extends Resource { + /** + * The provisioning status of the resource. + */ + provisioningState?: string; + /** + * The unique immutable identifier of a resource (Guid). + */ + uniqueIdentifier?: string; +} + +/** + * Result of the request to list REST API operations + */ +export interface ProviderOperationResult extends Array { + /** + * URL to get the next set of operation list results if there are any. + */ + readonly nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationLabAccount extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationGalleryImage extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationLab extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationEnvironmentSetting extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationEnvironment extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} + +/** + * The response of a list operation. + */ +export interface ResponseWithContinuationUser extends Array { + /** + * Link for next set of results. + */ + nextLink?: string; +} diff --git a/lib/services/labservicesManagement/lib/models/index.js b/lib/services/labservicesManagement/lib/models/index.js new file mode 100644 index 0000000000..84952fb6c8 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/index.js @@ -0,0 +1,88 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.AddUsersPayload = require('./addUsersPayload'); +exports.ReferenceVmCreationParameters = require('./referenceVmCreationParameters'); +exports.ResourceSettingCreationParameters = require('./resourceSettingCreationParameters'); +exports.EnvironmentSettingCreationParameters = require('./environmentSettingCreationParameters'); +exports.LabCreationParameters = require('./labCreationParameters'); +exports.CreateLabProperties = require('./createLabProperties'); +exports.ResourceSet = require('./resourceSet'); +exports.NetworkInterface = require('./networkInterface'); +exports.LatestOperationResult = require('./latestOperationResult'); +exports.Resource = require('./resource'); +exports.Environment = require('./environment'); +exports.VirtualMachineDetails = require('./virtualMachineDetails'); +exports.EnvironmentDetails = require('./environmentDetails'); +exports.ResourceSetFragment = require('./resourceSetFragment'); +exports.EnvironmentFragment = require('./environmentFragment'); +exports.EnvironmentOperationsPayload = require('./environmentOperationsPayload'); +exports.VmStateDetails = require('./vmStateDetails'); +exports.ReferenceVm = require('./referenceVm'); +exports.ResourceSettings = require('./resourceSettings'); +exports.EnvironmentSetting = require('./environmentSetting'); +exports.ReferenceVmFragment = require('./referenceVmFragment'); +exports.ResourceSettingsFragment = require('./resourceSettingsFragment'); +exports.EnvironmentSettingFragment = require('./environmentSettingFragment'); +exports.SizeInfo = require('./sizeInfo'); +exports.EnvironmentSize = require('./environmentSize'); +exports.SizeInfoFragment = require('./sizeInfoFragment'); +exports.EnvironmentSizeFragment = require('./environmentSizeFragment'); +exports.GalleryImageReference = require('./galleryImageReference'); +exports.GalleryImage = require('./galleryImage'); +exports.GalleryImageFragment = require('./galleryImageFragment'); +exports.GalleryImageReferenceFragment = require('./galleryImageReferenceFragment'); +exports.GetEnvironmentResponse = require('./getEnvironmentResponse'); +exports.GetPersonalPreferencesResponse = require('./getPersonalPreferencesResponse'); +exports.SizeAvailability = require('./sizeAvailability'); +exports.RegionalAvailability = require('./regionalAvailability'); +exports.GetRegionalAvailabilityResponse = require('./getRegionalAvailabilityResponse'); +exports.Lab = require('./lab'); +exports.SizeConfigurationProperties = require('./sizeConfigurationProperties'); +exports.LabAccount = require('./labAccount'); +exports.LabAccountFragment = require('./labAccountFragment'); +exports.LabDetails = require('./labDetails'); +exports.LabFragment = require('./labFragment'); +exports.ListEnvironmentsPayload = require('./listEnvironmentsPayload'); +exports.ListEnvironmentsResponse = require('./listEnvironmentsResponse'); +exports.ListLabsResponse = require('./listLabsResponse'); +exports.OperationBatchStatusPayload = require('./operationBatchStatusPayload'); +exports.OperationBatchStatusResponseItem = require('./operationBatchStatusResponseItem'); +exports.OperationBatchStatusResponse = require('./operationBatchStatusResponse'); +exports.OperationError = require('./operationError'); +exports.OperationMetadataDisplay = require('./operationMetadataDisplay'); +exports.OperationMetadata = require('./operationMetadata'); +exports.OperationResult = require('./operationResult'); +exports.OperationStatusPayload = require('./operationStatusPayload'); +exports.OperationStatusResponse = require('./operationStatusResponse'); +exports.PersonalPreferencesOperationsPayload = require('./personalPreferencesOperationsPayload'); +exports.PublishPayload = require('./publishPayload'); +exports.RegisterPayload = require('./registerPayload'); +exports.ResetPasswordPayload = require('./resetPasswordPayload'); +exports.SizeConfigurationPropertiesFragment = require('./sizeConfigurationPropertiesFragment'); +exports.User = require('./user'); +exports.UserFragment = require('./userFragment'); +exports.ProviderOperationResult = require('./providerOperationResult'); +exports.ResponseWithContinuationLabAccount = require('./responseWithContinuationLabAccount'); +exports.ResponseWithContinuationGalleryImage = require('./responseWithContinuationGalleryImage'); +exports.ResponseWithContinuationLab = require('./responseWithContinuationLab'); +exports.ResponseWithContinuationEnvironmentSetting = require('./responseWithContinuationEnvironmentSetting'); +exports.ResponseWithContinuationEnvironment = require('./responseWithContinuationEnvironment'); +exports.ResponseWithContinuationUser = require('./responseWithContinuationUser'); diff --git a/lib/services/labservicesManagement/lib/models/lab.js b/lib/services/labservicesManagement/lib/models/lab.js new file mode 100644 index 0000000000..de045b8fcb --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/lab.js @@ -0,0 +1,209 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab. + * + * @extends models['Resource'] + */ +class Lab extends models['Resource'] { + /** + * Create a Lab. + * @property {number} [maxUsersInLab] Maximum number of users allowed in the + * lab. + * @property {number} [userQuota] Maximum value MaxUsersInLab can be set to, + * as specified by the service + * @property {string} [invitationCode] Invitation code that users can use to + * join a lab. + * @property {string} [createdByObjectId] Object id of the user that created + * the lab. + * @property {moment.duration} [usageQuota] Maximum duration a user can use + * an environment for in the lab. + * @property {string} [userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * @property {string} [createdByUserPrincipalName] Lab creator name + * @property {date} [createdDate] Creation date for the lab + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Lab + * + * @returns {object} metadata of Lab + * + */ + mapper() { + return { + required: false, + serializedName: 'Lab', + type: { + name: 'Composite', + className: 'Lab', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + maxUsersInLab: { + required: false, + serializedName: 'properties.maxUsersInLab', + type: { + name: 'Number' + } + }, + userQuota: { + required: false, + readOnly: true, + serializedName: 'properties.userQuota', + type: { + name: 'Number' + } + }, + invitationCode: { + required: false, + readOnly: true, + serializedName: 'properties.invitationCode', + type: { + name: 'String' + } + }, + createdByObjectId: { + required: false, + readOnly: true, + serializedName: 'properties.createdByObjectId', + type: { + name: 'String' + } + }, + usageQuota: { + required: false, + serializedName: 'properties.usageQuota', + type: { + name: 'TimeSpan' + } + }, + userAccessMode: { + required: false, + serializedName: 'properties.userAccessMode', + type: { + name: 'String' + } + }, + createdByUserPrincipalName: { + required: false, + readOnly: true, + serializedName: 'properties.createdByUserPrincipalName', + type: { + name: 'String' + } + }, + createdDate: { + required: false, + readOnly: true, + serializedName: 'properties.createdDate', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = Lab; diff --git a/lib/services/labservicesManagement/lib/models/labAccount.js b/lib/services/labservicesManagement/lib/models/labAccount.js new file mode 100644 index 0000000000..e31e492c47 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/labAccount.js @@ -0,0 +1,155 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab account. + * + * @extends models['Resource'] + */ +class LabAccount extends models['Resource'] { + /** + * Create a LabAccount. + * @property {object} [sizeConfiguration] Represents the size configuration + * under the lab account + * @property {array} [sizeConfiguration.environmentSizes] Represents a list + * of size categories supported by this Lab Account (Small, Medium, Large) + * @property {boolean} [enabledRegionSelection] Represents if region + * selection is enabled + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LabAccount + * + * @returns {object} metadata of LabAccount + * + */ + mapper() { + return { + required: false, + serializedName: 'LabAccount', + type: { + name: 'Composite', + className: 'LabAccount', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sizeConfiguration: { + required: false, + readOnly: true, + serializedName: 'properties.sizeConfiguration', + type: { + name: 'Composite', + className: 'SizeConfigurationProperties' + } + }, + enabledRegionSelection: { + required: false, + serializedName: 'properties.enabledRegionSelection', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = LabAccount; diff --git a/lib/services/labservicesManagement/lib/models/labAccountFragment.js b/lib/services/labservicesManagement/lib/models/labAccountFragment.js new file mode 100644 index 0000000000..58f722cc5f --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/labAccountFragment.js @@ -0,0 +1,120 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab account. + * + * @extends models['Resource'] + */ +class LabAccountFragment extends models['Resource'] { + /** + * Create a LabAccountFragment. + * @property {boolean} [enabledRegionSelection] Represents if region + * selection is enabled + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LabAccountFragment + * + * @returns {object} metadata of LabAccountFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'LabAccountFragment', + type: { + name: 'Composite', + className: 'LabAccountFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabledRegionSelection: { + required: false, + serializedName: 'properties.enabledRegionSelection', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LabAccountFragment; diff --git a/lib/services/labservicesManagement/lib/models/labCreationParameters.js b/lib/services/labservicesManagement/lib/models/labCreationParameters.js new file mode 100644 index 0000000000..603f5c2e4b --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/labCreationParameters.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Settings related to creating a lab + * + */ +class LabCreationParameters { + /** + * Create a LabCreationParameters. + * @property {number} [maxUsersInLab] Maximum number of users allowed in the + * lab. + */ + constructor() { + } + + /** + * Defines the metadata of LabCreationParameters + * + * @returns {object} metadata of LabCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'LabCreationParameters', + type: { + name: 'Composite', + className: 'LabCreationParameters', + modelProperties: { + maxUsersInLab: { + required: false, + serializedName: 'maxUsersInLab', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = LabCreationParameters; diff --git a/lib/services/labservicesManagement/lib/models/labDetails.js b/lib/services/labservicesManagement/lib/models/labDetails.js new file mode 100644 index 0000000000..c7783e4a3e --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/labDetails.js @@ -0,0 +1,78 @@ +/* + * 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. + */ + +'use strict'; + +/** + * This represents the details about a lab that the User is in, and its state. + * + */ +class LabDetails { + /** + * Create a LabDetails. + * @property {string} [name] Name of the lab + * @property {string} [provisioningState] The provisioning state of the lab. + * @property {string} [id] The Id of the lab. + * @property {moment.duration} [usageQuota] The maximum duration a user can + * use a VM in this lab. + */ + constructor() { + } + + /** + * Defines the metadata of LabDetails + * + * @returns {object} metadata of LabDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'LabDetails', + type: { + name: 'Composite', + className: 'LabDetails', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + usageQuota: { + required: false, + readOnly: true, + serializedName: 'usageQuota', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = LabDetails; diff --git a/lib/services/labservicesManagement/lib/models/labFragment.js b/lib/services/labservicesManagement/lib/models/labFragment.js new file mode 100644 index 0000000000..9c56747cf1 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/labFragment.js @@ -0,0 +1,139 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Represents a lab. + * + * @extends models['Resource'] + */ +class LabFragment extends models['Resource'] { + /** + * Create a LabFragment. + * @property {number} [maxUsersInLab] Maximum number of users allowed in the + * lab. + * @property {moment.duration} [usageQuota] Maximum duration a user can use + * an environment for in the lab. + * @property {string} [userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LabFragment + * + * @returns {object} metadata of LabFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'LabFragment', + type: { + name: 'Composite', + className: 'LabFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + maxUsersInLab: { + required: false, + serializedName: 'properties.maxUsersInLab', + type: { + name: 'Number' + } + }, + usageQuota: { + required: false, + serializedName: 'properties.usageQuota', + type: { + name: 'TimeSpan' + } + }, + userAccessMode: { + required: false, + serializedName: 'properties.userAccessMode', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LabFragment; diff --git a/lib/services/labservicesManagement/lib/models/latestOperationResult.js b/lib/services/labservicesManagement/lib/models/latestOperationResult.js new file mode 100644 index 0000000000..0e0f595340 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/latestOperationResult.js @@ -0,0 +1,100 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of the status of an operation. + * + */ +class LatestOperationResult { + /** + * Create a LatestOperationResult. + * @property {string} [status] The current status of the operation. + * @property {string} [errorCode] Error code on failure. + * @property {string} [errorMessage] The error message. + * @property {string} [requestUri] Request URI of the operation. + * @property {string} [httpMethod] The HttpMethod - PUT/POST/DELETE for the + * operation. + * @property {string} [operationUrl] The URL to use to check long-running + * operation status + */ + constructor() { + } + + /** + * Defines the metadata of LatestOperationResult + * + * @returns {object} metadata of LatestOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LatestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult', + modelProperties: { + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + errorCode: { + required: false, + readOnly: true, + serializedName: 'errorCode', + type: { + name: 'String' + } + }, + errorMessage: { + required: false, + readOnly: true, + serializedName: 'errorMessage', + type: { + name: 'String' + } + }, + requestUri: { + required: false, + readOnly: true, + serializedName: 'requestUri', + type: { + name: 'String' + } + }, + httpMethod: { + required: false, + readOnly: true, + serializedName: 'httpMethod', + type: { + name: 'String' + } + }, + operationUrl: { + required: false, + readOnly: true, + serializedName: 'operationUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LatestOperationResult; diff --git a/lib/services/labservicesManagement/lib/models/listEnvironmentsPayload.js b/lib/services/labservicesManagement/lib/models/listEnvironmentsPayload.js new file mode 100644 index 0000000000..b36951ac7a --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/listEnvironmentsPayload.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the payload to list environments owned by a user + * + */ +class ListEnvironmentsPayload { + /** + * Create a ListEnvironmentsPayload. + * @property {string} [labId] The resource Id of the lab + */ + constructor() { + } + + /** + * Defines the metadata of ListEnvironmentsPayload + * + * @returns {object} metadata of ListEnvironmentsPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'ListEnvironmentsPayload', + type: { + name: 'Composite', + className: 'ListEnvironmentsPayload', + modelProperties: { + labId: { + required: false, + serializedName: 'labId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListEnvironmentsPayload; diff --git a/lib/services/labservicesManagement/lib/models/listEnvironmentsResponse.js b/lib/services/labservicesManagement/lib/models/listEnvironmentsResponse.js new file mode 100644 index 0000000000..733a028d6d --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/listEnvironmentsResponse.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the list of environments owned by a user + * + */ +class ListEnvironmentsResponse { + /** + * Create a ListEnvironmentsResponse. + * @property {array} [environments] List of all the environments + */ + constructor() { + } + + /** + * Defines the metadata of ListEnvironmentsResponse + * + * @returns {object} metadata of ListEnvironmentsResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ListEnvironmentsResponse', + type: { + name: 'Composite', + className: 'ListEnvironmentsResponse', + modelProperties: { + environments: { + required: false, + serializedName: 'environments', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentDetailsElementType', + type: { + name: 'Composite', + className: 'EnvironmentDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = ListEnvironmentsResponse; diff --git a/lib/services/labservicesManagement/lib/models/listLabsResponse.js b/lib/services/labservicesManagement/lib/models/listLabsResponse.js new file mode 100644 index 0000000000..a44c7cd1b9 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/listLabsResponse.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Lists the labs owned by a user + * + */ +class ListLabsResponse { + /** + * Create a ListLabsResponse. + * @property {array} [labs] List of all the labs + */ + constructor() { + } + + /** + * Defines the metadata of ListLabsResponse + * + * @returns {object} metadata of ListLabsResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ListLabsResponse', + type: { + name: 'Composite', + className: 'ListLabsResponse', + modelProperties: { + labs: { + required: false, + serializedName: 'labs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LabDetailsElementType', + type: { + name: 'Composite', + className: 'LabDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = ListLabsResponse; diff --git a/lib/services/labservicesManagement/lib/models/networkInterface.js b/lib/services/labservicesManagement/lib/models/networkInterface.js new file mode 100644 index 0000000000..d326ced02c --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/networkInterface.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Network details of the environment + * + */ +class NetworkInterface { + /** + * Create a NetworkInterface. + * @property {string} [privateIpAddress] PrivateIp address of the Compute VM + * @property {string} [sshAuthority] Connection information for Linux + * @property {string} [rdpAuthority] Connection information for Windows + * @property {string} [username] Username of the VM + */ + constructor() { + } + + /** + * Defines the metadata of NetworkInterface + * + * @returns {object} metadata of NetworkInterface + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterface', + type: { + name: 'Composite', + className: 'NetworkInterface', + modelProperties: { + privateIpAddress: { + required: false, + readOnly: true, + serializedName: 'privateIpAddress', + type: { + name: 'String' + } + }, + sshAuthority: { + required: false, + readOnly: true, + serializedName: 'sshAuthority', + type: { + name: 'String' + } + }, + rdpAuthority: { + required: false, + readOnly: true, + serializedName: 'rdpAuthority', + type: { + name: 'String' + } + }, + username: { + required: false, + readOnly: true, + serializedName: 'username', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterface; diff --git a/lib/services/labservicesManagement/lib/models/operationBatchStatusPayload.js b/lib/services/labservicesManagement/lib/models/operationBatchStatusPayload.js new file mode 100644 index 0000000000..5f23d3d610 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationBatchStatusPayload.js @@ -0,0 +1,59 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload to get the status of an operation + * + */ +class OperationBatchStatusPayload { + /** + * Create a OperationBatchStatusPayload. + * @property {array} urls The operation url of long running operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationBatchStatusPayload + * + * @returns {object} metadata of OperationBatchStatusPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationBatchStatusPayload', + type: { + name: 'Composite', + className: 'OperationBatchStatusPayload', + modelProperties: { + urls: { + required: true, + serializedName: 'urls', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationBatchStatusPayload; diff --git a/lib/services/labservicesManagement/lib/models/operationBatchStatusResponse.js b/lib/services/labservicesManagement/lib/models/operationBatchStatusResponse.js new file mode 100644 index 0000000000..2bcb238440 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationBatchStatusResponse.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Status Details of the long running operation for an environment + * + */ +class OperationBatchStatusResponse { + /** + * Create a OperationBatchStatusResponse. + * @property {array} [items] Gets a collection of items that contain the + * operation url and status. + */ + constructor() { + } + + /** + * Defines the metadata of OperationBatchStatusResponse + * + * @returns {object} metadata of OperationBatchStatusResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationBatchStatusResponse', + type: { + name: 'Composite', + className: 'OperationBatchStatusResponse', + modelProperties: { + items: { + required: false, + readOnly: true, + serializedName: 'items', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationBatchStatusResponseItemElementType', + type: { + name: 'Composite', + className: 'OperationBatchStatusResponseItem' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationBatchStatusResponse; diff --git a/lib/services/labservicesManagement/lib/models/operationBatchStatusResponseItem.js b/lib/services/labservicesManagement/lib/models/operationBatchStatusResponseItem.js new file mode 100644 index 0000000000..c22e60f8af --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationBatchStatusResponseItem.js @@ -0,0 +1,64 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the status of an operation that used the batch API. + * + */ +class OperationBatchStatusResponseItem { + /** + * Create a OperationBatchStatusResponseItem. + * @property {string} [operationUrl] status of the long running operation for + * an environment + * @property {string} [status] status of the long running operation for an + * environment + */ + constructor() { + } + + /** + * Defines the metadata of OperationBatchStatusResponseItem + * + * @returns {object} metadata of OperationBatchStatusResponseItem + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationBatchStatusResponseItem', + type: { + name: 'Composite', + className: 'OperationBatchStatusResponseItem', + modelProperties: { + operationUrl: { + required: false, + readOnly: true, + serializedName: 'operationUrl', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationBatchStatusResponseItem; diff --git a/lib/services/labservicesManagement/lib/models/operationError.js b/lib/services/labservicesManagement/lib/models/operationError.js new file mode 100644 index 0000000000..0bd412effe --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationError.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Error details for the operation in case of a failure. + * + */ +class OperationError { + /** + * Create a OperationError. + * @property {string} [code] The error code of the operation error. + * @property {string} [message] The error message of the operation error. + */ + constructor() { + } + + /** + * Defines the metadata of OperationError + * + * @returns {object} metadata of OperationError + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationError', + type: { + name: 'Composite', + className: 'OperationError', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationError; diff --git a/lib/services/labservicesManagement/lib/models/operationMetadata.js b/lib/services/labservicesManagement/lib/models/operationMetadata.js new file mode 100644 index 0000000000..130322eaf2 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationMetadata.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The REST API operation supported by ManagedLab ResourceProvider. + * + */ +class OperationMetadata { + /** + * Create a OperationMetadata. + * @property {string} [name] Operation name: + * {provider}/{resource}/{operation} + * @property {object} [display] The object that describes the operations + * @property {string} [display.provider] Friendly name of the resource + * provider + * @property {string} [display.resource] Resource type on which the operation + * is performed. + * @property {string} [display.operation] Operation type: read, write, + * delete, listKeys/action, etc. + * @property {string} [display.description] Friendly name of the operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationMetadata + * + * @returns {object} metadata of OperationMetadata + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationMetadata', + type: { + name: 'Composite', + className: 'OperationMetadata', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationMetadataDisplay' + } + } + } + } + }; + } +} + +module.exports = OperationMetadata; diff --git a/lib/services/labservicesManagement/lib/models/operationMetadataDisplay.js b/lib/services/labservicesManagement/lib/models/operationMetadataDisplay.js new file mode 100644 index 0000000000..22d6618847 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationMetadataDisplay.js @@ -0,0 +1,78 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The object that describes the operations + * + */ +class OperationMetadataDisplay { + /** + * Create a OperationMetadataDisplay. + * @property {string} [provider] Friendly name of the resource provider + * @property {string} [resource] Resource type on which the operation is + * performed. + * @property {string} [operation] Operation type: read, write, delete, + * listKeys/action, etc. + * @property {string} [description] Friendly name of the operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationMetadataDisplay + * + * @returns {object} metadata of OperationMetadataDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationMetadataDisplay', + type: { + name: 'Composite', + className: 'OperationMetadataDisplay', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationMetadataDisplay; diff --git a/lib/services/labservicesManagement/lib/models/operationResult.js b/lib/services/labservicesManagement/lib/models/operationResult.js new file mode 100644 index 0000000000..1ba24ba129 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationResult.js @@ -0,0 +1,65 @@ +/* + * 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. + */ + +'use strict'; + +/** + * An Operation Result + * + */ +class OperationResult { + /** + * Create a OperationResult. + * @property {string} [status] The operation status. + * @property {object} [error] Error details for the operation in case of a + * failure. + * @property {string} [error.code] The error code of the operation error. + * @property {string} [error.message] The error message of the operation + * error. + */ + constructor() { + } + + /** + * Defines the metadata of OperationResult + * + * @returns {object} metadata of OperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationResult', + type: { + name: 'Composite', + className: 'OperationResult', + modelProperties: { + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'OperationError' + } + } + } + } + }; + } +} + +module.exports = OperationResult; diff --git a/lib/services/labservicesManagement/lib/models/operationStatusPayload.js b/lib/services/labservicesManagement/lib/models/operationStatusPayload.js new file mode 100644 index 0000000000..37221932dc --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationStatusPayload.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload to get the status of an operation + * + */ +class OperationStatusPayload { + /** + * Create a OperationStatusPayload. + * @property {string} operationUrl The operation url of long running + * operation + */ + constructor() { + } + + /** + * Defines the metadata of OperationStatusPayload + * + * @returns {object} metadata of OperationStatusPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationStatusPayload', + type: { + name: 'Composite', + className: 'OperationStatusPayload', + modelProperties: { + operationUrl: { + required: true, + serializedName: 'operationUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationStatusPayload; diff --git a/lib/services/labservicesManagement/lib/models/operationStatusResponse.js b/lib/services/labservicesManagement/lib/models/operationStatusResponse.js new file mode 100644 index 0000000000..210c261c71 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/operationStatusResponse.js @@ -0,0 +1,54 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Status Details of the long running operation for an environment + * + */ +class OperationStatusResponse { + /** + * Create a OperationStatusResponse. + * @property {string} [status] status of the long running operation for an + * environment + */ + constructor() { + } + + /** + * Defines the metadata of OperationStatusResponse + * + * @returns {object} metadata of OperationStatusResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationStatusResponse', + type: { + name: 'Composite', + className: 'OperationStatusResponse', + modelProperties: { + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationStatusResponse; diff --git a/lib/services/labservicesManagement/lib/models/personalPerferencesOperationsPayload.js b/lib/services/labservicesManagement/lib/models/personalPerferencesOperationsPayload.js new file mode 100644 index 0000000000..4dc95446b3 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/personalPerferencesOperationsPayload.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents payload for any Environment operations like get, start, stop, + * connect + * + */ +class PersonalPerferencesOperationsPayload { + /** + * Create a PersonalPerferencesOperationsPayload. + * @property {string} [labAccountResourceId] Resource Id of the lab account + * @property {string} [addRemove] Enum indicating if user is adding or + * removing a favorite lab. Possible values include: 'Add', 'Remove' + * @property {string} [labResourceId] Resource Id of the lab to add/remove + * from the favorites list + */ + constructor() { + } + + /** + * Defines the metadata of PersonalPerferencesOperationsPayload + * + * @returns {object} metadata of PersonalPerferencesOperationsPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'PersonalPerferencesOperationsPayload', + type: { + name: 'Composite', + className: 'PersonalPerferencesOperationsPayload', + modelProperties: { + labAccountResourceId: { + required: false, + serializedName: 'labAccountResourceId', + type: { + name: 'String' + } + }, + addRemove: { + required: false, + serializedName: 'addRemove', + type: { + name: 'String' + } + }, + labResourceId: { + required: false, + serializedName: 'labResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PersonalPerferencesOperationsPayload; diff --git a/lib/services/labservicesManagement/lib/models/personalPreferencesOperationsPayload.js b/lib/services/labservicesManagement/lib/models/personalPreferencesOperationsPayload.js new file mode 100644 index 0000000000..81bc96b529 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/personalPreferencesOperationsPayload.js @@ -0,0 +1,71 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents payload for any Environment operations like get, start, stop, + * connect + * + */ +class PersonalPreferencesOperationsPayload { + /** + * Create a PersonalPreferencesOperationsPayload. + * @property {string} [labAccountResourceId] Resource Id of the lab account + * @property {string} [addRemove] Enum indicating if user is adding or + * removing a favorite lab. Possible values include: 'Add', 'Remove' + * @property {string} [labResourceId] Resource Id of the lab to add/remove + * from the favorites list + */ + constructor() { + } + + /** + * Defines the metadata of PersonalPreferencesOperationsPayload + * + * @returns {object} metadata of PersonalPreferencesOperationsPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'PersonalPreferencesOperationsPayload', + type: { + name: 'Composite', + className: 'PersonalPreferencesOperationsPayload', + modelProperties: { + labAccountResourceId: { + required: false, + serializedName: 'labAccountResourceId', + type: { + name: 'String' + } + }, + addRemove: { + required: false, + serializedName: 'addRemove', + type: { + name: 'String' + } + }, + labResourceId: { + required: false, + serializedName: 'labResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PersonalPreferencesOperationsPayload; diff --git a/lib/services/labservicesManagement/lib/models/providerOperationResult.js b/lib/services/labservicesManagement/lib/models/providerOperationResult.js new file mode 100644 index 0000000000..232bb874da --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/providerOperationResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Result of the request to list REST API operations + */ +class ProviderOperationResult extends Array { + /** + * Create a ProviderOperationResult. + * @property {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ProviderOperationResult + * + * @returns {object} metadata of ProviderOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ProviderOperationResult', + type: { + name: 'Composite', + className: 'ProviderOperationResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationMetadataElementType', + type: { + name: 'Composite', + className: 'OperationMetadata' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ProviderOperationResult; diff --git a/lib/services/labservicesManagement/lib/models/publishPayload.js b/lib/services/labservicesManagement/lib/models/publishPayload.js new file mode 100644 index 0000000000..7e312f6f70 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/publishPayload.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Payload for Publish operation on EnvironmentSetting. + * + */ +class PublishPayload { + /** + * Create a PublishPayload. + * @property {boolean} [useExistingImage] Whether to use existing VM custom + * image when publishing. + */ + constructor() { + } + + /** + * Defines the metadata of PublishPayload + * + * @returns {object} metadata of PublishPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'PublishPayload', + type: { + name: 'Composite', + className: 'PublishPayload', + modelProperties: { + useExistingImage: { + required: false, + serializedName: 'useExistingImage', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = PublishPayload; diff --git a/lib/services/labservicesManagement/lib/models/referenceVm.js b/lib/services/labservicesManagement/lib/models/referenceVm.js new file mode 100644 index 0000000000..b97fdea167 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/referenceVm.js @@ -0,0 +1,91 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of a Reference Vm + * + */ +class ReferenceVm { + /** + * Create a ReferenceVm. + * @property {string} userName The username of the virtual machine + * @property {string} [password] The password of the virtual machine. This + * will be set to null in GET resource API + * @property {object} [vmStateDetails] The state details for the reference + * virtual machine. + * @property {string} [vmStateDetails.rdpAuthority] The RdpAuthority property + * is a server DNS host name or IP address followed by the service port + * number for RDP (Remote Desktop Protocol). + * @property {string} [vmStateDetails.sshAuthority] The SshAuthority property + * is a server DNS host name or IP address followed by the service port + * number for SSH. + * @property {string} [vmStateDetails.powerState] The power state of the + * reference virtual machine. + * @property {string} [vmStateDetails.lastKnownPowerState] Last known compute + * power state captured in DTL + * @property {string} [vmResourceId] VM resource Id for the environment + */ + constructor() { + } + + /** + * Defines the metadata of ReferenceVm + * + * @returns {object} metadata of ReferenceVm + * + */ + mapper() { + return { + required: false, + serializedName: 'ReferenceVm', + type: { + name: 'Composite', + className: 'ReferenceVm', + modelProperties: { + userName: { + required: true, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + }, + vmStateDetails: { + required: false, + readOnly: true, + serializedName: 'vmStateDetails', + type: { + name: 'Composite', + className: 'VmStateDetails' + } + }, + vmResourceId: { + required: false, + readOnly: true, + serializedName: 'vmResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReferenceVm; diff --git a/lib/services/labservicesManagement/lib/models/referenceVmCreationParameters.js b/lib/services/labservicesManagement/lib/models/referenceVmCreationParameters.js new file mode 100644 index 0000000000..f9dc0ef3de --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/referenceVmCreationParameters.js @@ -0,0 +1,60 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Creation parameters for Reference Vm + * + */ +class ReferenceVmCreationParameters { + /** + * Create a ReferenceVmCreationParameters. + * @property {string} userName The username of the virtual machine + * @property {string} password The password of the virtual machine. + */ + constructor() { + } + + /** + * Defines the metadata of ReferenceVmCreationParameters + * + * @returns {object} metadata of ReferenceVmCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ReferenceVmCreationParameters', + type: { + name: 'Composite', + className: 'ReferenceVmCreationParameters', + modelProperties: { + userName: { + required: true, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: true, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReferenceVmCreationParameters; diff --git a/lib/services/labservicesManagement/lib/models/referenceVmFragment.js b/lib/services/labservicesManagement/lib/models/referenceVmFragment.js new file mode 100644 index 0000000000..fe5a2f1b46 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/referenceVmFragment.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of a Reference Vm + * + */ +class ReferenceVmFragment { + /** + * Create a ReferenceVmFragment. + * @property {string} [userName] The username of the virtual machine + * @property {string} [password] The password of the virtual machine. This + * will be set to null in GET resource API + */ + constructor() { + } + + /** + * Defines the metadata of ReferenceVmFragment + * + * @returns {object} metadata of ReferenceVmFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'ReferenceVmFragment', + type: { + name: 'Composite', + className: 'ReferenceVmFragment', + modelProperties: { + userName: { + required: false, + serializedName: 'userName', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReferenceVmFragment; diff --git a/lib/services/labservicesManagement/lib/models/regionalAvailability.js b/lib/services/labservicesManagement/lib/models/regionalAvailability.js new file mode 100644 index 0000000000..a18f652db8 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/regionalAvailability.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The availability information of sizes across regions + * + */ +class RegionalAvailability { + /** + * Create a RegionalAvailability. + * @property {string} [region] Corresponding region + * @property {array} [sizeAvailabilities] List of all the size information + * for the region + */ + constructor() { + } + + /** + * Defines the metadata of RegionalAvailability + * + * @returns {object} metadata of RegionalAvailability + * + */ + mapper() { + return { + required: false, + serializedName: 'RegionalAvailability', + type: { + name: 'Composite', + className: 'RegionalAvailability', + modelProperties: { + region: { + required: false, + serializedName: 'region', + type: { + name: 'String' + } + }, + sizeAvailabilities: { + required: false, + serializedName: 'sizeAvailabilities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SizeAvailabilityElementType', + type: { + name: 'Composite', + className: 'SizeAvailability' + } + } + } + } + } + } + }; + } +} + +module.exports = RegionalAvailability; diff --git a/lib/services/labservicesManagement/lib/models/registerPayload.js b/lib/services/labservicesManagement/lib/models/registerPayload.js new file mode 100644 index 0000000000..5af9b3aa1a --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/registerPayload.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents payload for Register action. + * + */ +class RegisterPayload { + /** + * Create a RegisterPayload. + * @property {string} [registrationCode] The registration code of the lab. + */ + constructor() { + } + + /** + * Defines the metadata of RegisterPayload + * + * @returns {object} metadata of RegisterPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'RegisterPayload', + type: { + name: 'Composite', + className: 'RegisterPayload', + modelProperties: { + registrationCode: { + required: false, + serializedName: 'registrationCode', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegisterPayload; diff --git a/lib/services/labservicesManagement/lib/models/resetPasswordPayload.js b/lib/services/labservicesManagement/lib/models/resetPasswordPayload.js new file mode 100644 index 0000000000..d436143831 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/resetPasswordPayload.js @@ -0,0 +1,70 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the payload for resetting passwords. + * + */ +class ResetPasswordPayload { + /** + * Create a ResetPasswordPayload. + * @property {string} environmentId The resourceId of the environment + * @property {string} [username] The username for which the password will be + * reset. + * @property {string} [password] The password to assign to the user specified + * in + */ + constructor() { + } + + /** + * Defines the metadata of ResetPasswordPayload + * + * @returns {object} metadata of ResetPasswordPayload + * + */ + mapper() { + return { + required: false, + serializedName: 'ResetPasswordPayload', + type: { + name: 'Composite', + className: 'ResetPasswordPayload', + modelProperties: { + environmentId: { + required: true, + serializedName: 'environmentId', + type: { + name: 'String' + } + }, + username: { + required: false, + serializedName: 'username', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResetPasswordPayload; diff --git a/lib/services/labservicesManagement/lib/models/resource.js b/lib/services/labservicesManagement/lib/models/resource.js new file mode 100644 index 0000000000..b87b434982 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/resource.js @@ -0,0 +1,98 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An Azure resource. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @property {string} [id] The identifier of the resource. + * @property {string} [name] The name of the resource. + * @property {string} [type] The type of the resource. + * @property {string} [location] The location of the resource. + * @property {object} [tags] The tags of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/labservicesManagement/lib/models/resourceSet.js b/lib/services/labservicesManagement/lib/models/resourceSet.js new file mode 100644 index 0000000000..0196d9a3ab --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/resourceSet.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a VM and the setting Id it was created for. + * + */ +class ResourceSet { + /** + * Create a ResourceSet. + * @property {string} [vmResourceId] VM resource Id for the environment + * @property {string} [resourceSettingId] resourceSettingId for the + * environment + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSet + * + * @returns {object} metadata of ResourceSet + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSet', + type: { + name: 'Composite', + className: 'ResourceSet', + modelProperties: { + vmResourceId: { + required: false, + serializedName: 'vmResourceId', + type: { + name: 'String' + } + }, + resourceSettingId: { + required: false, + serializedName: 'resourceSettingId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceSet; diff --git a/lib/services/labservicesManagement/lib/models/resourceSetFragment.js b/lib/services/labservicesManagement/lib/models/resourceSetFragment.js new file mode 100644 index 0000000000..a86584680c --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/resourceSetFragment.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents a VM and the setting Id it was created for. + * + */ +class ResourceSetFragment { + /** + * Create a ResourceSetFragment. + * @property {string} [vmResourceId] VM resource Id for the environment + * @property {string} [resourceSettingId] resourceSettingId for the + * environment + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSetFragment + * + * @returns {object} metadata of ResourceSetFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSetFragment', + type: { + name: 'Composite', + className: 'ResourceSetFragment', + modelProperties: { + vmResourceId: { + required: false, + serializedName: 'vmResourceId', + type: { + name: 'String' + } + }, + resourceSettingId: { + required: false, + serializedName: 'resourceSettingId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceSetFragment; diff --git a/lib/services/labservicesManagement/lib/models/resourceSettingCreationParameters.js b/lib/services/labservicesManagement/lib/models/resourceSettingCreationParameters.js new file mode 100644 index 0000000000..700b3cf867 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/resourceSettingCreationParameters.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents resource specific settings + * + */ +class ResourceSettingCreationParameters { + /** + * Create a ResourceSettingCreationParameters. + * @property {string} [location] The location where the virtual machine will + * live + * @property {string} [name] The name of the resource setting + * @property {string} galleryImageResourceId The resource id of the gallery + * image used for creating the virtual machine + * @property {string} [size] The size of the virtual machine. Possible values + * include: 'Basic', 'Standard', 'Performance' + * @property {object} referenceVmCreationParameters Creation parameters for + * Reference Vm + * @property {string} [referenceVmCreationParameters.userName] The username + * of the virtual machine + * @property {string} [referenceVmCreationParameters.password] The password + * of the virtual machine. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSettingCreationParameters + * + * @returns {object} metadata of ResourceSettingCreationParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSettingCreationParameters', + type: { + name: 'Composite', + className: 'ResourceSettingCreationParameters', + modelProperties: { + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + galleryImageResourceId: { + required: true, + serializedName: 'galleryImageResourceId', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + referenceVmCreationParameters: { + required: true, + serializedName: 'referenceVmCreationParameters', + type: { + name: 'Composite', + className: 'ReferenceVmCreationParameters' + } + } + } + } + }; + } +} + +module.exports = ResourceSettingCreationParameters; diff --git a/lib/services/labservicesManagement/lib/models/resourceSettings.js b/lib/services/labservicesManagement/lib/models/resourceSettings.js new file mode 100644 index 0000000000..c51e2e2b92 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/resourceSettings.js @@ -0,0 +1,118 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents resource specific settings + * + */ +class ResourceSettings { + /** + * Create a ResourceSettings. + * @property {string} [id] The unique id of the resource setting + * @property {string} [galleryImageResourceId] The resource id of the gallery + * image used for creating the virtual machine + * @property {string} [imageName] The name of the image used to created the + * environment setting + * @property {string} [size] The size of the virtual machine. Possible values + * include: 'Basic', 'Standard', 'Performance' + * @property {number} [cores] The translated compute cores of the virtual + * machine + * @property {object} referenceVm Details specific to Reference Vm + * @property {string} [referenceVm.userName] The username of the virtual + * machine + * @property {string} [referenceVm.password] The password of the virtual + * machine. This will be set to null in GET resource API + * @property {object} [referenceVm.vmStateDetails] The state details for the + * reference virtual machine. + * @property {string} [referenceVm.vmStateDetails.rdpAuthority] The + * RdpAuthority property is a server DNS host name or IP address followed by + * the service port number for RDP (Remote Desktop Protocol). + * @property {string} [referenceVm.vmStateDetails.sshAuthority] The + * SshAuthority property is a server DNS host name or IP address followed by + * the service port number for SSH. + * @property {string} [referenceVm.vmStateDetails.powerState] The power state + * of the reference virtual machine. + * @property {string} [referenceVm.vmStateDetails.lastKnownPowerState] Last + * known compute power state captured in DTL + * @property {string} [referenceVm.vmResourceId] VM resource Id for the + * environment + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSettings + * + * @returns {object} metadata of ResourceSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSettings', + type: { + name: 'Composite', + className: 'ResourceSettings', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + galleryImageResourceId: { + required: false, + serializedName: 'galleryImageResourceId', + type: { + name: 'String' + } + }, + imageName: { + required: false, + readOnly: true, + serializedName: 'imageName', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + cores: { + required: false, + readOnly: true, + serializedName: 'cores', + type: { + name: 'Number' + } + }, + referenceVm: { + required: true, + serializedName: 'referenceVm', + type: { + name: 'Composite', + className: 'ReferenceVm' + } + } + } + } + }; + } +} + +module.exports = ResourceSettings; diff --git a/lib/services/labservicesManagement/lib/models/resourceSettingsFragment.js b/lib/services/labservicesManagement/lib/models/resourceSettingsFragment.js new file mode 100644 index 0000000000..83e9e0dd4f --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/resourceSettingsFragment.js @@ -0,0 +1,75 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents resource specific settings + * + */ +class ResourceSettingsFragment { + /** + * Create a ResourceSettingsFragment. + * @property {string} [galleryImageResourceId] The resource id of the gallery + * image used for creating the virtual machine + * @property {string} [size] The size of the virtual machine. Possible values + * include: 'Basic', 'Standard', 'Performance' + * @property {object} [referenceVm] Details specific to Reference Vm + * @property {string} [referenceVm.userName] The username of the virtual + * machine + * @property {string} [referenceVm.password] The password of the virtual + * machine. This will be set to null in GET resource API + */ + constructor() { + } + + /** + * Defines the metadata of ResourceSettingsFragment + * + * @returns {object} metadata of ResourceSettingsFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceSettingsFragment', + type: { + name: 'Composite', + className: 'ResourceSettingsFragment', + modelProperties: { + galleryImageResourceId: { + required: false, + serializedName: 'galleryImageResourceId', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + referenceVm: { + required: false, + serializedName: 'referenceVm', + type: { + name: 'Composite', + className: 'ReferenceVmFragment' + } + } + } + } + }; + } +} + +module.exports = ResourceSettingsFragment; diff --git a/lib/services/labservicesManagement/lib/models/responseWithContinuationEnvironment.js b/lib/services/labservicesManagement/lib/models/responseWithContinuationEnvironment.js new file mode 100644 index 0000000000..cf116dfea6 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/responseWithContinuationEnvironment.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationEnvironment extends Array { + /** + * Create a ResponseWithContinuationEnvironment. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationEnvironment + * + * @returns {object} metadata of ResponseWithContinuationEnvironment + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_Environment_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationEnvironment', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentElementType', + type: { + name: 'Composite', + className: 'Environment' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationEnvironment; diff --git a/lib/services/labservicesManagement/lib/models/responseWithContinuationEnvironmentSetting.js b/lib/services/labservicesManagement/lib/models/responseWithContinuationEnvironmentSetting.js new file mode 100644 index 0000000000..10dda716ec --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/responseWithContinuationEnvironmentSetting.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationEnvironmentSetting extends Array { + /** + * Create a ResponseWithContinuationEnvironmentSetting. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationEnvironmentSetting + * + * @returns {object} metadata of ResponseWithContinuationEnvironmentSetting + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_EnvironmentSetting_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationEnvironmentSetting', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentSettingElementType', + type: { + name: 'Composite', + className: 'EnvironmentSetting' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationEnvironmentSetting; diff --git a/lib/services/labservicesManagement/lib/models/responseWithContinuationGalleryImage.js b/lib/services/labservicesManagement/lib/models/responseWithContinuationGalleryImage.js new file mode 100644 index 0000000000..ac52b6b373 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/responseWithContinuationGalleryImage.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationGalleryImage extends Array { + /** + * Create a ResponseWithContinuationGalleryImage. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationGalleryImage + * + * @returns {object} metadata of ResponseWithContinuationGalleryImage + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_GalleryImage_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationGalleryImage', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'GalleryImageElementType', + type: { + name: 'Composite', + className: 'GalleryImage' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationGalleryImage; diff --git a/lib/services/labservicesManagement/lib/models/responseWithContinuationLab.js b/lib/services/labservicesManagement/lib/models/responseWithContinuationLab.js new file mode 100644 index 0000000000..9e6521bf82 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/responseWithContinuationLab.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationLab extends Array { + /** + * Create a ResponseWithContinuationLab. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationLab + * + * @returns {object} metadata of ResponseWithContinuationLab + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_Lab_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationLab', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LabElementType', + type: { + name: 'Composite', + className: 'Lab' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationLab; diff --git a/lib/services/labservicesManagement/lib/models/responseWithContinuationLabAccount.js b/lib/services/labservicesManagement/lib/models/responseWithContinuationLabAccount.js new file mode 100644 index 0000000000..c55d9b515e --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/responseWithContinuationLabAccount.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationLabAccount extends Array { + /** + * Create a ResponseWithContinuationLabAccount. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationLabAccount + * + * @returns {object} metadata of ResponseWithContinuationLabAccount + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_LabAccount_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationLabAccount', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LabAccountElementType', + type: { + name: 'Composite', + className: 'LabAccount' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationLabAccount; diff --git a/lib/services/labservicesManagement/lib/models/responseWithContinuationUser.js b/lib/services/labservicesManagement/lib/models/responseWithContinuationUser.js new file mode 100644 index 0000000000..eb9cbe69f3 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/responseWithContinuationUser.js @@ -0,0 +1,67 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response of a list operation. + */ +class ResponseWithContinuationUser extends Array { + /** + * Create a ResponseWithContinuationUser. + * @property {string} [nextLink] Link for next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResponseWithContinuationUser + * + * @returns {object} metadata of ResponseWithContinuationUser + * + */ + mapper() { + return { + required: false, + serializedName: 'ResponseWithContinuation_User_', + type: { + name: 'Composite', + className: 'ResponseWithContinuationUser', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UserElementType', + type: { + name: 'Composite', + className: 'User' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseWithContinuationUser; diff --git a/lib/services/labservicesManagement/lib/models/sizeAvailability.js b/lib/services/labservicesManagement/lib/models/sizeAvailability.js new file mode 100644 index 0000000000..05c80fb101 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/sizeAvailability.js @@ -0,0 +1,63 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the size information + * + */ +class SizeAvailability { + /** + * Create a SizeAvailability. + * @property {string} [sizeCategory] The category of the size (Basic, + * Standard, Performance). Possible values include: 'Basic', 'Standard', + * 'Performance' + * @property {boolean} [isAvailable] Whether or not this size category is + * available + */ + constructor() { + } + + /** + * Defines the metadata of SizeAvailability + * + * @returns {object} metadata of SizeAvailability + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeAvailability', + type: { + name: 'Composite', + className: 'SizeAvailability', + modelProperties: { + sizeCategory: { + required: false, + serializedName: 'sizeCategory', + type: { + name: 'String' + } + }, + isAvailable: { + required: false, + serializedName: 'isAvailable', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = SizeAvailability; diff --git a/lib/services/labservicesManagement/lib/models/sizeConfigurationProperties.js b/lib/services/labservicesManagement/lib/models/sizeConfigurationProperties.js new file mode 100644 index 0000000000..40600275f4 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/sizeConfigurationProperties.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the size configuration under the lab account + * + */ +class SizeConfigurationProperties { + /** + * Create a SizeConfigurationProperties. + * @property {array} [environmentSizes] Represents a list of size categories + * supported by this Lab Account (Small, Medium, Large) + */ + constructor() { + } + + /** + * Defines the metadata of SizeConfigurationProperties + * + * @returns {object} metadata of SizeConfigurationProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeConfigurationProperties', + type: { + name: 'Composite', + className: 'SizeConfigurationProperties', + modelProperties: { + environmentSizes: { + required: false, + serializedName: 'environmentSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentSizeElementType', + type: { + name: 'Composite', + className: 'EnvironmentSize' + } + } + } + } + } + } + }; + } +} + +module.exports = SizeConfigurationProperties; diff --git a/lib/services/labservicesManagement/lib/models/sizeConfigurationPropertiesFragment.js b/lib/services/labservicesManagement/lib/models/sizeConfigurationPropertiesFragment.js new file mode 100644 index 0000000000..7fe0191ff8 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/sizeConfigurationPropertiesFragment.js @@ -0,0 +1,61 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Represents the size configuration under the lab account + * + */ +class SizeConfigurationPropertiesFragment { + /** + * Create a SizeConfigurationPropertiesFragment. + * @property {array} [environmentSizes] Represents a list of size categories + * supported by this Lab Account (Small, Medium, Large) + */ + constructor() { + } + + /** + * Defines the metadata of SizeConfigurationPropertiesFragment + * + * @returns {object} metadata of SizeConfigurationPropertiesFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeConfigurationPropertiesFragment', + type: { + name: 'Composite', + className: 'SizeConfigurationPropertiesFragment', + modelProperties: { + environmentSizes: { + required: false, + serializedName: 'environmentSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentSizeFragmentElementType', + type: { + name: 'Composite', + className: 'EnvironmentSizeFragment' + } + } + } + } + } + } + }; + } +} + +module.exports = SizeConfigurationPropertiesFragment; diff --git a/lib/services/labservicesManagement/lib/models/sizeInfo.js b/lib/services/labservicesManagement/lib/models/sizeInfo.js new file mode 100644 index 0000000000..ef68779b2c --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/sizeInfo.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Contains detailed information about a size + * + */ +class SizeInfo { + /** + * Create a SizeInfo. + * @property {string} [computeSize] Represents the actual compute size, e.g. + * Standard_A2_v2. + * @property {number} [price] The pay-as-you-go price per hour this size will + * cost. It does not include discounts and may not reflect the actual price + * the size will cost. + * @property {number} [numberOfCores] The number of cores a VM of this size + * has. + * @property {number} [memory] The amount of memory available (in GB). + */ + constructor() { + } + + /** + * Defines the metadata of SizeInfo + * + * @returns {object} metadata of SizeInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeInfo', + type: { + name: 'Composite', + className: 'SizeInfo', + modelProperties: { + computeSize: { + required: false, + serializedName: 'computeSize', + type: { + name: 'String' + } + }, + price: { + required: false, + serializedName: 'price', + type: { + name: 'Number' + } + }, + numberOfCores: { + required: false, + serializedName: 'numberOfCores', + type: { + name: 'Number' + } + }, + memory: { + required: false, + serializedName: 'memory', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = SizeInfo; diff --git a/lib/services/labservicesManagement/lib/models/sizeInfoFragment.js b/lib/services/labservicesManagement/lib/models/sizeInfoFragment.js new file mode 100644 index 0000000000..a7cec899af --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/sizeInfoFragment.js @@ -0,0 +1,80 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Contains detailed information about a size + * + */ +class SizeInfoFragment { + /** + * Create a SizeInfoFragment. + * @property {string} [computeSize] Represents the actual compute size, e.g. + * Standard_A2_v2. + * @property {number} [price] The pay-as-you-go price per hour this size will + * cost. It does not include discounts and may not reflect the actual price + * the size will cost. + * @property {number} [numberOfCores] The number of cores a VM of this size + * has. + * @property {number} [memory] The amount of memory available (in GB). + */ + constructor() { + } + + /** + * Defines the metadata of SizeInfoFragment + * + * @returns {object} metadata of SizeInfoFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'SizeInfoFragment', + type: { + name: 'Composite', + className: 'SizeInfoFragment', + modelProperties: { + computeSize: { + required: false, + serializedName: 'computeSize', + type: { + name: 'String' + } + }, + price: { + required: false, + serializedName: 'price', + type: { + name: 'Number' + } + }, + numberOfCores: { + required: false, + serializedName: 'numberOfCores', + type: { + name: 'Number' + } + }, + memory: { + required: false, + serializedName: 'memory', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = SizeInfoFragment; diff --git a/lib/services/labservicesManagement/lib/models/user.js b/lib/services/labservicesManagement/lib/models/user.js new file mode 100644 index 0000000000..026b81166c --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/user.js @@ -0,0 +1,183 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The User registered to a lab + * + * @extends models['Resource'] + */ +class User extends models['Resource'] { + /** + * Create a User. + * @property {string} [email] The user email address, as it was specified + * during registration. + * @property {string} [familyName] The user family name, as it was specified + * during registration. + * @property {string} [givenName] The user given name, as it was specified + * during registration. + * @property {string} [tenantId] The user tenant ID, as it was specified + * during registration. + * @property {moment.duration} [totalUsage] How long the user has used his + * VMs in this lab + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * @property {object} [latestOperationResult] The details of the latest + * operation. ex: status, error + * @property {string} [latestOperationResult.status] The current status of + * the operation. + * @property {string} [latestOperationResult.errorCode] Error code on + * failure. + * @property {string} [latestOperationResult.errorMessage] The error message. + * @property {string} [latestOperationResult.requestUri] Request URI of the + * operation. + * @property {string} [latestOperationResult.httpMethod] The HttpMethod - + * PUT/POST/DELETE for the operation. + * @property {string} [latestOperationResult.operationUrl] The URL to use to + * check long-running operation status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of User + * + * @returns {object} metadata of User + * + */ + mapper() { + return { + required: false, + serializedName: 'User', + type: { + name: 'Composite', + className: 'User', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + email: { + required: false, + readOnly: true, + serializedName: 'properties.email', + type: { + name: 'String' + } + }, + familyName: { + required: false, + readOnly: true, + serializedName: 'properties.familyName', + type: { + name: 'String' + } + }, + givenName: { + required: false, + readOnly: true, + serializedName: 'properties.givenName', + type: { + name: 'String' + } + }, + tenantId: { + required: false, + readOnly: true, + serializedName: 'properties.tenantId', + type: { + name: 'String' + } + }, + totalUsage: { + required: false, + readOnly: true, + serializedName: 'properties.totalUsage', + type: { + name: 'TimeSpan' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + }, + latestOperationResult: { + required: false, + readOnly: true, + serializedName: 'properties.latestOperationResult', + type: { + name: 'Composite', + className: 'LatestOperationResult' + } + } + } + } + }; + } +} + +module.exports = User; diff --git a/lib/services/labservicesManagement/lib/models/userFragment.js b/lib/services/labservicesManagement/lib/models/userFragment.js new file mode 100644 index 0000000000..bef94a5f02 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/userFragment.js @@ -0,0 +1,111 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The User registered to a lab + * + * @extends models['Resource'] + */ +class UserFragment extends models['Resource'] { + /** + * Create a UserFragment. + * @property {string} [provisioningState] The provisioning status of the + * resource. + * @property {string} [uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of UserFragment + * + * @returns {object} metadata of UserFragment + * + */ + mapper() { + return { + required: false, + serializedName: 'UserFragment', + type: { + name: 'Composite', + className: 'UserFragment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + uniqueIdentifier: { + required: false, + serializedName: 'properties.uniqueIdentifier', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UserFragment; diff --git a/lib/services/labservicesManagement/lib/models/virtualMachineDetails.js b/lib/services/labservicesManagement/lib/models/virtualMachineDetails.js new file mode 100644 index 0000000000..0844ed5e07 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/virtualMachineDetails.js @@ -0,0 +1,99 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details of the backing virtual machine. + * + */ +class VirtualMachineDetails { + /** + * Create a VirtualMachineDetails. + * @property {string} [provisioningState] Provisioning state of the Dtl VM + * @property {string} [rdpAuthority] Connection information for Windows + * @property {string} [sshAuthority] Connection information for Linux + * @property {string} [privateIpAddress] PrivateIp address of the compute VM + * @property {string} [userName] Compute VM login user name + * @property {string} [lastKnownPowerState] Last known compute power state + * captured in DTL + */ + constructor() { + } + + /** + * Defines the metadata of VirtualMachineDetails + * + * @returns {object} metadata of VirtualMachineDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualMachineDetails', + type: { + name: 'Composite', + className: 'VirtualMachineDetails', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + rdpAuthority: { + required: false, + readOnly: true, + serializedName: 'rdpAuthority', + type: { + name: 'String' + } + }, + sshAuthority: { + required: false, + readOnly: true, + serializedName: 'sshAuthority', + type: { + name: 'String' + } + }, + privateIpAddress: { + required: false, + readOnly: true, + serializedName: 'privateIpAddress', + type: { + name: 'String' + } + }, + userName: { + required: false, + readOnly: true, + serializedName: 'userName', + type: { + name: 'String' + } + }, + lastKnownPowerState: { + required: false, + readOnly: true, + serializedName: 'lastKnownPowerState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualMachineDetails; diff --git a/lib/services/labservicesManagement/lib/models/vmStateDetails.js b/lib/services/labservicesManagement/lib/models/vmStateDetails.js new file mode 100644 index 0000000000..cd5ba6da21 --- /dev/null +++ b/lib/services/labservicesManagement/lib/models/vmStateDetails.js @@ -0,0 +1,85 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Details about the state of the reference virtual machine. + * + */ +class VmStateDetails { + /** + * Create a VmStateDetails. + * @property {string} [rdpAuthority] The RdpAuthority property is a server + * DNS host name or IP address followed by the service port number for RDP + * (Remote Desktop Protocol). + * @property {string} [sshAuthority] The SshAuthority property is a server + * DNS host name or IP address followed by the service port number for SSH. + * @property {string} [powerState] The power state of the reference virtual + * machine. + * @property {string} [lastKnownPowerState] Last known compute power state + * captured in DTL + */ + constructor() { + } + + /** + * Defines the metadata of VmStateDetails + * + * @returns {object} metadata of VmStateDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'VmStateDetails', + type: { + name: 'Composite', + className: 'VmStateDetails', + modelProperties: { + rdpAuthority: { + required: false, + readOnly: true, + serializedName: 'rdpAuthority', + type: { + name: 'String' + } + }, + sshAuthority: { + required: false, + readOnly: true, + serializedName: 'sshAuthority', + type: { + name: 'String' + } + }, + powerState: { + required: false, + readOnly: true, + serializedName: 'powerState', + type: { + name: 'String' + } + }, + lastKnownPowerState: { + required: false, + readOnly: true, + serializedName: 'lastKnownPowerState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VmStateDetails; diff --git a/lib/services/labservicesManagement/lib/operations/environmentSettings.js b/lib/services/labservicesManagement/lib/operations/environmentSettings.js new file mode 100644 index 0000000000..d70595954d --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/environmentSettings.js @@ -0,0 +1,3630 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentSetting === null || environmentSetting === undefined) { + throw new Error('environmentSetting cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentSetting !== null && environmentSetting !== undefined) { + let requestModelMapper = new client.models['EnvironmentSettingFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentSetting, 'environmentSetting'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentSetting, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/claimAny'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (publishPayload === null || publishPayload === undefined) { + throw new Error('publishPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/publish'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (publishPayload !== null && publishPayload !== undefined) { + let requestModelMapper = new client.models['PublishPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, publishPayload, 'publishPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(publishPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _start(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentSetting === null || environmentSetting === undefined) { + throw new Error('environmentSetting cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentSetting !== null && environmentSetting !== undefined) { + let requestModelMapper = new client.models['EnvironmentSetting']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentSetting, 'environmentSetting'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentSetting, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/start'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/stop'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironmentSetting']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a EnvironmentSettings. */ +class EnvironmentSettings { + /** + * Create a EnvironmentSettings. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._claimAny = _claimAny; + this._publish = _publish; + this._start = _start; + this._stop = _stop; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginStart = _beginStart; + this._beginStop = _beginStop; + this._listNext = _listNext; + } + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback); + } + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback); + } + } + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + claimAnyWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._claimAny(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + publishWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._publish(resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._start(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting, options, optionalCallback); + } + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = EnvironmentSettings; diff --git a/lib/services/labservicesManagement/lib/operations/environments.js b/lib/services/labservicesManagement/lib/operations/environments.js new file mode 100644 index 0000000000..cc1e65a022 --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/environments.js @@ -0,0 +1,3528 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; +const moment = require('moment'); + +/** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, labName, environmentSettingName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (environment === null || environment === undefined) { + throw new Error('environment cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environment !== null && environment !== undefined) { + let requestModelMapper = new client.models['Environment']().mapper(); + requestModel = client.serialize(requestModelMapper, environment, 'environment'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environment, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (environment === null || environment === undefined) { + throw new Error('environment cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environment !== null && environment !== undefined) { + let requestModelMapper = new client.models['EnvironmentFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, environment, 'environment'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environment, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Environment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/claim'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (resetPasswordPayload === null || resetPasswordPayload === undefined) { + throw new Error('resetPasswordPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (resetPasswordPayload !== null && resetPasswordPayload !== undefined) { + let requestModelMapper = new client.models['ResetPasswordPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, resetPasswordPayload, 'resetPasswordPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(resetPasswordPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (environmentSettingName === null || environmentSettingName === undefined || typeof environmentSettingName.valueOf() !== 'string') { + throw new Error('environmentSettingName cannot be null or undefined and it must be of type string.'); + } + if (environmentName === null || environmentName === undefined || typeof environmentName.valueOf() !== 'string') { + throw new Error('environmentName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{environmentSettingName}', encodeURIComponent(environmentSettingName)); + requestUrl = requestUrl.replace('{environmentName}', encodeURIComponent(environmentName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationEnvironment']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Environments. */ +class Environments { + /** + * Create a Environments. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._claim = _claim; + this._resetPassword = _resetPassword; + this._start = _start; + this._stop = _stop; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginResetPassword = _beginResetPassword; + this._beginStart = _beginStart; + this._beginStop = _beginStop; + this._listNext = _listNext; + } + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, environmentSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, labName, environmentSettingName, options, optionalCallback); + } + } + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback); + } + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment, options, optionalCallback); + } + } + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + claimWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._claim(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + resetPasswordWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._start(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginResetPassword(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStart(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStop(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, options, optionalCallback); + } + } + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Environments; diff --git a/lib/services/labservicesManagement/lib/operations/galleryImages.js b/lib/services/labservicesManagement/lib/operations/galleryImages.js new file mode 100644 index 0000000000..056f926563 --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/galleryImages.js @@ -0,0 +1,1680 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationGalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, galleryImageName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (galleryImage === null || galleryImage === undefined) { + throw new Error('galleryImage cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (galleryImage !== null && galleryImage !== undefined) { + let requestModelMapper = new client.models['GalleryImage']().mapper(); + requestModel = client.serialize(requestModelMapper, galleryImage, 'galleryImage'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(galleryImage, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (galleryImageName === null || galleryImageName === undefined || typeof galleryImageName.valueOf() !== 'string') { + throw new Error('galleryImageName cannot be null or undefined and it must be of type string.'); + } + if (galleryImage === null || galleryImage === undefined) { + throw new Error('galleryImage cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{galleryImageName}', encodeURIComponent(galleryImageName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (galleryImage !== null && galleryImage !== undefined) { + let requestModelMapper = new client.models['GalleryImageFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, galleryImage, 'galleryImage'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(galleryImage, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationGalleryImage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a GalleryImages. */ +class GalleryImages { + /** + * Create a GalleryImages. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listNext = _listNext; + } + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, galleryImage, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback); + } + } + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, galleryImageName, options, optionalCallback); + } + } + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, galleryImageName, galleryImage, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, galleryImageName, galleryImage, options, optionalCallback); + } + } + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = GalleryImages; diff --git a/lib/services/labservicesManagement/lib/operations/globalUsers.js b/lib/services/labservicesManagement/lib/operations/globalUsers.js new file mode 100644 index 0000000000..f8b541683a --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/globalUsers.js @@ -0,0 +1,3026 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetEnvironmentResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (environmentOperationsPayload === null || environmentOperationsPayload === undefined) { + throw new Error('environmentOperationsPayload cannot be null or undefined.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getEnvironment'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentOperationsPayload !== null && environmentOperationsPayload !== undefined) { + let requestModelMapper = new client.models['EnvironmentOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentOperationsPayload, 'environmentOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GetEnvironmentResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationBatchStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getOperationBatchStatus(userName, operationBatchStatusPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (operationBatchStatusPayload === null || operationBatchStatusPayload === undefined) { + throw new Error('operationBatchStatusPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (operationBatchStatusPayload !== null && operationBatchStatusPayload !== undefined) { + let requestModelMapper = new client.models['OperationBatchStatusPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, operationBatchStatusPayload, 'operationBatchStatusPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(operationBatchStatusPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationBatchStatusResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getOperationStatus(userName, operationStatusPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (operationStatusPayload === null || operationStatusPayload === undefined) { + throw new Error('operationStatusPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getOperationStatus'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (operationStatusPayload !== null && operationStatusPayload !== undefined) { + let requestModelMapper = new client.models['OperationStatusPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, operationStatusPayload, 'operationStatusPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(operationStatusPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationStatusResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPreferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPreferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPreferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPreferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetPersonalPreferencesResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getPersonalPreferences(userName, personalPreferencesOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (personalPreferencesOperationsPayload === null || personalPreferencesOperationsPayload === undefined) { + throw new Error('personalPreferencesOperationsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (personalPreferencesOperationsPayload !== null && personalPreferencesOperationsPayload !== undefined) { + let requestModelMapper = new client.models['PersonalPreferencesOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, personalPreferencesOperationsPayload, 'personalPreferencesOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(personalPreferencesOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GetPersonalPreferencesResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListEnvironmentsResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listEnvironments(userName, listEnvironmentsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (listEnvironmentsPayload === null || listEnvironmentsPayload === undefined) { + throw new Error('listEnvironmentsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/listEnvironments'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (listEnvironmentsPayload !== null && listEnvironmentsPayload !== undefined) { + let requestModelMapper = new client.models['ListEnvironmentsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, listEnvironmentsPayload, 'listEnvironmentsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(listEnvironmentsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ListEnvironmentsResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListLabsResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listLabs(userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/listLabs'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ListLabsResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _register(userName, registerPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (registerPayload === null || registerPayload === undefined) { + throw new Error('registerPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/register'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (registerPayload !== null && registerPayload !== undefined) { + let requestModelMapper = new client.models['RegisterPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, registerPayload, 'registerPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(registerPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _resetPassword(userName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginResetPassword(userName, resetPasswordPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _startEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStartEnvironment(userName, environmentOperationsPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stopEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginStopEnvironment(userName, environmentOperationsPayload, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginResetPassword(userName, resetPasswordPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (resetPasswordPayload === null || resetPasswordPayload === undefined) { + throw new Error('resetPasswordPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/resetPassword'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (resetPasswordPayload !== null && resetPasswordPayload !== undefined) { + let requestModelMapper = new client.models['ResetPasswordPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, resetPasswordPayload, 'resetPasswordPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(resetPasswordPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStartEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (environmentOperationsPayload === null || environmentOperationsPayload === undefined) { + throw new Error('environmentOperationsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/startEnvironment'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentOperationsPayload !== null && environmentOperationsPayload !== undefined) { + let requestModelMapper = new client.models['EnvironmentOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentOperationsPayload, 'environmentOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStopEnvironment(userName, environmentOperationsPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (environmentOperationsPayload === null || environmentOperationsPayload === undefined) { + throw new Error('environmentOperationsPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/users/{userName}/stopEnvironment'; + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (environmentOperationsPayload !== null && environmentOperationsPayload !== undefined) { + let requestModelMapper = new client.models['EnvironmentOperationsPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, environmentOperationsPayload, 'environmentOperationsPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(environmentOperationsPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a GlobalUsers. */ +class GlobalUsers { + /** + * Create a GlobalUsers. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getEnvironment = _getEnvironment; + this._getOperationBatchStatus = _getOperationBatchStatus; + this._getOperationStatus = _getOperationStatus; + this._getPersonalPreferences = _getPersonalPreferences; + this._listEnvironments = _listEnvironments; + this._listLabs = _listLabs; + this._register = _register; + this._resetPassword = _resetPassword; + this._startEnvironment = _startEnvironment; + this._stopEnvironment = _stopEnvironment; + this._beginResetPassword = _beginResetPassword; + this._beginStartEnvironment = _beginStartEnvironment; + this._beginStopEnvironment = _beginStopEnvironment; + } + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GetEnvironmentResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetEnvironmentResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getOperationBatchStatusWithHttpOperationResponse(userName, operationBatchStatusPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getOperationBatchStatus(userName, operationBatchStatusPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationBatchStatusResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationBatchStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationBatchStatus(userName, operationBatchStatusPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getOperationBatchStatus(userName, operationBatchStatusPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getOperationBatchStatus(userName, operationBatchStatusPayload, options, optionalCallback); + } + } + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getOperationStatusWithHttpOperationResponse(userName, operationStatusPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getOperationStatus(userName, operationStatusPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationStatusResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationStatus(userName, operationStatusPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getOperationStatus(userName, operationStatusPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getOperationStatus(userName, operationStatusPayload, options, optionalCallback); + } + } + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPreferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPreferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPreferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPreferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getPersonalPreferencesWithHttpOperationResponse(userName, personalPreferencesOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getPersonalPreferences(userName, personalPreferencesOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPreferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPreferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPreferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPreferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GetPersonalPreferencesResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetPersonalPreferencesResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getPersonalPreferences(userName, personalPreferencesOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getPersonalPreferences(userName, personalPreferencesOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getPersonalPreferences(userName, personalPreferencesOperationsPayload, options, optionalCallback); + } + } + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listEnvironmentsWithHttpOperationResponse(userName, listEnvironmentsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listEnvironments(userName, listEnvironmentsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ListEnvironmentsResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListEnvironmentsResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listEnvironments(userName, listEnvironmentsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listEnvironments(userName, listEnvironmentsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listEnvironments(userName, listEnvironmentsPayload, options, optionalCallback); + } + } + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listLabsWithHttpOperationResponse(userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listLabs(userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ListLabsResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ListLabsResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listLabs(userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listLabs(userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listLabs(userName, options, optionalCallback); + } + } + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + registerWithHttpOperationResponse(userName, registerPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._register(userName, registerPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + register(userName, registerPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._register(userName, registerPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._register(userName, registerPayload, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + resetPasswordWithHttpOperationResponse(userName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(userName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._resetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resetPassword(userName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + startEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._startEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + startEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._startEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._startEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + stopEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stopEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._stopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stopEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(userName, resetPasswordPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginResetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(userName, resetPasswordPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginResetPassword(userName, resetPasswordPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginResetPassword(userName, resetPasswordPayload, options, optionalCallback); + } + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStartEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStartEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStartEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStartEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStartEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginStopEnvironmentWithHttpOperationResponse(userName, environmentOperationsPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStopEnvironment(userName, environmentOperationsPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginStopEnvironment(userName, environmentOperationsPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStopEnvironment(userName, environmentOperationsPayload, options, optionalCallback); + } + } + +} + +module.exports = GlobalUsers; diff --git a/lib/services/labservicesManagement/lib/operations/index.d.ts b/lib/services/labservicesManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..3e56331d53 --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/index.d.ts @@ -0,0 +1,6080 @@ +/* + * 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 { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as moment from 'moment'; +import * as models from '../models'; + + +/** + * @class + * ProviderOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface ProviderOperations { + + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ProviderOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ProviderOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * GlobalUsers + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface GlobalUsers { + + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the virtual machine details + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=environment)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GetEnvironmentResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GetEnvironmentResponse} [result] - The deserialized result object if an error did not occur. + * See {@link GetEnvironmentResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + getEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getOperationBatchStatusWithHttpOperationResponse(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get batch operation status + * + * @param {string} userName The name of the user. + * + * @param {object} operationBatchStatusPayload Payload to get the status of an + * operation + * + * @param {array} operationBatchStatusPayload.urls The operation url of long + * running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationBatchStatusResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationBatchStatusResponse} [result] - The deserialized result object if an error did not occur. + * See {@link OperationBatchStatusResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationBatchStatus(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getOperationBatchStatus(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, callback: ServiceCallback): void; + getOperationBatchStatus(userName: string, operationBatchStatusPayload: models.OperationBatchStatusPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getOperationStatusWithHttpOperationResponse(userName: string, operationStatusPayload: models.OperationStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the status of long running operation + * + * @param {string} userName The name of the user. + * + * @param {object} operationStatusPayload Payload to get the status of an + * operation + * + * @param {string} operationStatusPayload.operationUrl The operation url of + * long running operation + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationStatusResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationStatusResponse} [result] - The deserialized result object if an error did not occur. + * See {@link OperationStatusResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getOperationStatus(userName: string, operationStatusPayload: models.OperationStatusPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getOperationStatus(userName: string, operationStatusPayload: models.OperationStatusPayload, callback: ServiceCallback): void; + getOperationStatus(userName: string, operationStatusPayload: models.OperationStatusPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPreferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPreferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPreferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPreferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getPersonalPreferencesWithHttpOperationResponse(userName: string, personalPreferencesOperationsPayload: models.PersonalPreferencesOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get personal preferences for a user + * + * @param {string} userName The name of the user. + * + * @param {object} personalPreferencesOperationsPayload Represents payload for + * any Environment operations like get, start, stop, connect + * + * @param {string} [personalPreferencesOperationsPayload.labAccountResourceId] + * Resource Id of the lab account + * + * @param {string} [personalPreferencesOperationsPayload.addRemove] Enum + * indicating if user is adding or removing a favorite lab. Possible values + * include: 'Add', 'Remove' + * + * @param {string} [personalPreferencesOperationsPayload.labResourceId] + * Resource Id of the lab to add/remove from the favorites list + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GetPersonalPreferencesResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GetPersonalPreferencesResponse} [result] - The deserialized result object if an error did not occur. + * See {@link GetPersonalPreferencesResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getPersonalPreferences(userName: string, personalPreferencesOperationsPayload: models.PersonalPreferencesOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getPersonalPreferences(userName: string, personalPreferencesOperationsPayload: models.PersonalPreferencesOperationsPayload, callback: ServiceCallback): void; + getPersonalPreferences(userName: string, personalPreferencesOperationsPayload: models.PersonalPreferencesOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listEnvironmentsWithHttpOperationResponse(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List Environments for the user + * + * @param {string} userName The name of the user. + * + * @param {object} listEnvironmentsPayload Represents the payload to list + * environments owned by a user + * + * @param {string} [listEnvironmentsPayload.labId] The resource Id of the lab + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ListEnvironmentsResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ListEnvironmentsResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ListEnvironmentsResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listEnvironments(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listEnvironments(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, callback: ServiceCallback): void; + listEnvironments(userName: string, listEnvironmentsPayload: models.ListEnvironmentsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listLabsWithHttpOperationResponse(userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List labs for the user. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ListLabsResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ListLabsResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ListLabsResponse} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listLabs(userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listLabs(userName: string, callback: ServiceCallback): void; + listLabs(userName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + registerWithHttpOperationResponse(userName: string, registerPayload: models.RegisterPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Register a user to a managed lab + * + * @param {string} userName The name of the user. + * + * @param {object} registerPayload Represents payload for Register action. + * + * @param {string} [registerPayload.registrationCode] The registration code of + * the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + register(userName: string, registerPayload: models.RegisterPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + register(userName: string, registerPayload: models.RegisterPayload, callback: ServiceCallback): void; + register(userName: string, registerPayload: models.RegisterPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + resetPasswordWithHttpOperationResponse(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + resetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + startEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + startEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + startEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + startEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + stopEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + stopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} userName The name of the user. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + beginResetPassword(userName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStartEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStartEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStartEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + beginStartEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStopEnvironmentWithHttpOperationResponse(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} userName The name of the user. + * + * @param {object} environmentOperationsPayload Represents payload for any + * Environment operations like get, start, stop, connect + * + * @param {string} environmentOperationsPayload.environmentId The resourceId of + * the environment + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, callback: ServiceCallback): void; + beginStopEnvironment(userName: string, environmentOperationsPayload: models.EnvironmentOperationsPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LabAccounts + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface LabAccounts { + + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccount, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labAccount: models.LabAccountFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createLabWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createLab(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createLab(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, callback: ServiceCallback): void; + createLab(resourceGroupName: string, labAccountName: string, createLabProperties: models.CreateLabProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getRegionalAvailabilityWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GetRegionalAvailabilityResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GetRegionalAvailabilityResponse} [result] - The deserialized result object if an error did not occur. + * See {@link GetRegionalAvailabilityResponse} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getRegionalAvailability(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getRegionalAvailability(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + getRegionalAvailability(resourceGroupName: string, labAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLabAccount} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Operations { + + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(locationName: string, operationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {OperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(locationName: string, operationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(locationName: string, operationName: string, callback: ServiceCallback): void; + get(locationName: string, operationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * GalleryImages + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface GalleryImages { + + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List gallery images in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationGalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get gallery image + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=author)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, galleryImageName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, galleryImageName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Gallery Image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImage, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete gallery image. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, galleryImageName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, galleryImageName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, galleryImageName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of gallery images. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} galleryImageName The name of the gallery Image. + * + * @param {object} galleryImage Represents an image from the Azure Marketplace + * + * @param {boolean} [galleryImage.isEnabled] Indicates whether this gallery + * image is enabled. + * + * @param {boolean} [galleryImage.isOverride] Indicates whether this gallery + * has been overridden for this lab account + * + * @param {boolean} [galleryImage.isPlanAuthorized] Indicates if the plan has + * been authorized for programmatic deployment. + * + * @param {string} [galleryImage.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [galleryImage.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [galleryImage.location] The location of the resource. + * + * @param {object} [galleryImage.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {GalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {GalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link GalleryImage} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, galleryImageName: string, galleryImage: models.GalleryImageFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List gallery images in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationGalleryImage} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationGalleryImage} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationGalleryImage} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Labs + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Labs { + + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLab} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Lab} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Lab} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, lab: models.Lab, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Lab} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, lab: models.LabFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + addUsersWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + addUsers(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + addUsers(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, callback: ServiceCallback): void; + addUsers(resourceGroupName: string, labAccountName: string, labName: string, addUsersPayload: models.AddUsersPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + registerWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + register(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + register(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + register(resourceGroupName: string, labAccountName: string, labName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationLab} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * EnvironmentSettings + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface EnvironmentSettings { + + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environment setting in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, labName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get environment setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=publishingState)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} [environmentSetting.resourceSettings] The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} [environmentSetting.resourceSettings.referenceVm] Details + * specific to Reference Vm + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.userName] + * The username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSettingFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + claimAnyWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Claims a random environment for a user in an environment settings + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + claimAny(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + claimAny(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + claimAny(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + publishWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Provisions/deprovisions required resources for an environment setting based + * on current state of the lab/environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} publishPayload Payload for Publish operation on + * EnvironmentSetting. + * + * @param {boolean} [publishPayload.useExistingImage] Whether to use existing + * VM custom image when publishing. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + publish(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + publish(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, callback: ServiceCallback): void; + publish(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, publishPayload: models.PublishPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Environment Setting. This operation can take a + * while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} environmentSetting Represents settings of an environment, + * from which environment instances would be created + * + * @param {string} [environmentSetting.configurationState] Describes the user's + * progress in configuring their environment setting. Possible values include: + * 'NotApplicable', 'Completed' + * + * @param {string} [environmentSetting.description] Describes the environment + * and its resource settings + * + * @param {string} [environmentSetting.title] Brief title describing the + * environment and its resource settings + * + * @param {object} environmentSetting.resourceSettings The resource specific + * settings + * + * @param {string} [environmentSetting.resourceSettings.galleryImageResourceId] + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.size] The size of the + * virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + * + * @param {object} environmentSetting.resourceSettings.referenceVm Details + * specific to Reference Vm + * + * @param {string} environmentSetting.resourceSettings.referenceVm.userName The + * username of the virtual machine + * + * @param {string} [environmentSetting.resourceSettings.referenceVm.password] + * The password of the virtual machine. This will be set to null in GET + * resource API + * + * @param {string} [environmentSetting.provisioningState] The provisioning + * status of the resource. + * + * @param {string} [environmentSetting.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environmentSetting.location] The location of the resource. + * + * @param {object} [environmentSetting.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link EnvironmentSetting} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentSetting: models.EnvironmentSetting, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment setting. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts a template by starting all resources inside the template. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environment setting in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironmentSetting} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironmentSetting} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironmentSetting} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Environments + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Environments { + + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environments in a given environment setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironment} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get environment + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=networkInterface)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Environment} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing Environment. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Environment} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.Environment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of environments. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} environment Represents an environment instance + * + * @param {object} [environment.resourceSets] The set of a VM and the setting + * id it was created for + * + * @param {string} [environment.resourceSets.vmResourceId] VM resource Id for + * the environment + * + * @param {string} [environment.resourceSets.resourceSettingId] + * resourceSettingId for the environment + * + * @param {string} [environment.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [environment.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [environment.location] The location of the resource. + * + * @param {object} [environment.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Environment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Environment} [result] - The deserialized result object if an error did not occur. + * See {@link Environment} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, environment: models.EnvironmentFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + claimWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Claims the environment and assigns it to the user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + claim(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + claim(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + claim(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + resetPasswordWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + resetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + resetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + startWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + start(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + stopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete environment. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginResetPasswordWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the user password on an environment This operation can take a while + * to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} resetPasswordPayload Represents the payload for resetting + * passwords. + * + * @param {string} resetPasswordPayload.environmentId The resourceId of the + * environment + * + * @param {string} [resetPasswordPayload.username] The username for which the + * password will be reset. + * + * @param {string} [resetPasswordPayload.password] The password to assign to + * the user specified in + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginResetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, callback: ServiceCallback): void; + beginResetPassword(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, resetPasswordPayload: models.ResetPasswordPayload, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStartWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts an environment by starting all resources inside the environment. This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + beginStart(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginStopWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops an environment by stopping all resources inside the environment This + * operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} environmentSettingName The name of the environment Setting. + * + * @param {string} environmentName The name of the environment. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, callback: ServiceCallback): void; + beginStop(resourceGroupName: string, labAccountName: string, labName: string, environmentSettingName: string, environmentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List environments in a given environment setting. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationEnvironment} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationEnvironment} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationEnvironment} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Users + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagedLabsClient. + */ +export interface Users { + + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationUser} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, labAccountName: string, labName: string, options?: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, labAccountName: string, labName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, labAccountName: string, labName: string, options: { expand? : string, filter? : string, top? : number, orderby? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, labAccountName: string, labName: string, userName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.User, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {User} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, callback: ServiceCallback): void; + update(resourceGroupName: string, labAccountName: string, labName: string, userName: string, user: models.UserFragment, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, labAccountName: string, labName: string, userName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ResponseWithContinuationUser} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/labservicesManagement/lib/operations/index.js b/lib/services/labservicesManagement/lib/operations/index.js new file mode 100644 index 0000000000..3b439d9ef6 --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/index.js @@ -0,0 +1,25 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.ProviderOperations = require('./providerOperations'); +exports.GlobalUsers = require('./globalUsers'); +exports.LabAccounts = require('./labAccounts'); +exports.Operations = require('./operations'); +exports.GalleryImages = require('./galleryImages'); +exports.Labs = require('./labs'); +exports.EnvironmentSettings = require('./environmentSettings'); +exports.Environments = require('./environments'); +exports.Users = require('./users'); diff --git a/lib/services/labservicesManagement/lib/operations/labAccounts.js b/lib/services/labservicesManagement/lib/operations/labAccounts.js new file mode 100644 index 0000000000..a029e6b09c --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/labAccounts.js @@ -0,0 +1,2852 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labaccounts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labAccount, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labAccount === null || labAccount === undefined) { + throw new Error('labAccount cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (labAccount !== null && labAccount !== undefined) { + let requestModelMapper = new client.models['LabAccount']().mapper(); + requestModel = client.serialize(requestModelMapper, labAccount, 'labAccount'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(labAccount, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labAccount, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labAccount === null || labAccount === undefined) { + throw new Error('labAccount cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (labAccount !== null && labAccount !== undefined) { + let requestModelMapper = new client.models['LabAccountFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, labAccount, 'labAccount'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(labAccount, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createLab(resourceGroupName, labAccountName, createLabProperties, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (createLabProperties === null || createLabProperties === undefined) { + throw new Error('createLabProperties cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/createLab'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (createLabProperties !== null && createLabProperties !== undefined) { + let requestModelMapper = new client.models['CreateLabProperties']().mapper(); + requestModel = client.serialize(requestModelMapper, createLabProperties, 'createLabProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(createLabProperties, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetRegionalAvailabilityResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getRegionalAvailability(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/getRegionalAvailability'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['GetRegionalAvailabilityResponse']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscriptionNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLabAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LabAccounts. */ +class LabAccounts { + /** + * Create a LabAccounts. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySubscription = _listBySubscription; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._createLab = _createLab; + this._getRegionalAvailability = _getRegionalAvailability; + this._beginDeleteMethod = _beginDeleteMethod; + this._listBySubscriptionNext = _listBySubscriptionNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($expand=sizeConfiguration)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labAccount, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Lab Account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labAccount, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labAccount, options, optionalCallback); + } + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labAccount, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of lab accounts. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} labAccount Represents a lab account. + * + * @param {boolean} [labAccount.enabledRegionSelection] Represents if region + * selection is enabled + * + * @param {string} [labAccount.provisioningState] The provisioning status of + * the resource. + * + * @param {string} [labAccount.uniqueIdentifier] The unique immutable + * identifier of a resource (Guid). + * + * @param {string} [labAccount.location] The location of the resource. + * + * @param {object} [labAccount.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LabAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labAccount, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labAccount, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labAccount, options, optionalCallback); + } + } + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createLabWithHttpOperationResponse(resourceGroupName, labAccountName, createLabProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createLab(resourceGroupName, labAccountName, createLabProperties, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a lab in a lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} createLabProperties Properties for creating a managed lab + * and a default environment setting + * + * @param {object} [createLabProperties.environmentSettingCreationParameters] + * Settings related to creating an environment setting + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters + * The resource specific settings + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.location] + * The location where the virtual machine will live + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.name] + * The name of the resource setting + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.galleryImageResourceId + * The resource id of the gallery image used for creating the virtual machine + * + * @param {string} + * [createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.size] + * The size of the virtual machine. Possible values include: 'Basic', + * 'Standard', 'Performance' + * + * @param {object} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters + * Creation parameters for Reference Vm + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.userName + * The username of the virtual machine + * + * @param {string} + * createLabProperties.environmentSettingCreationParameters.resourceSettingCreationParameters.referenceVmCreationParameters.password + * The password of the virtual machine. + * + * @param {object} createLabProperties.labCreationParameters Settings related + * to creating a lab + * + * @param {number} [createLabProperties.labCreationParameters.maxUsersInLab] + * Maximum number of users allowed in the lab. + * + * @param {string} createLabProperties.name The name of the resource + * + * @param {string} [createLabProperties.location] The location of the resource + * + * @param {object} [createLabProperties.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createLab(resourceGroupName, labAccountName, createLabProperties, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createLab(resourceGroupName, labAccountName, createLabProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createLab(resourceGroupName, labAccountName, createLabProperties, options, optionalCallback); + } + } + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getRegionalAvailabilityWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getRegionalAvailability(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get regional availability information for each size category configured + * under a lab account + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {GetRegionalAvailabilityResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link GetRegionalAvailabilityResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getRegionalAvailability(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getRegionalAvailability(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getRegionalAvailability(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab account. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscriptionNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List lab accounts in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLabAccount} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLabAccount} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LabAccounts; diff --git a/lib/services/labservicesManagement/lib/operations/labs.js b/lib/services/labservicesManagement/lib/operations/labs.js new file mode 100644 index 0000000000..6c1943e021 --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/labs.js @@ -0,0 +1,2320 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; +const moment = require('moment'); + +/** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (lab === null || lab === undefined) { + throw new Error('lab cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (lab !== null && lab !== undefined) { + let requestModelMapper = new client.models['Lab']().mapper(); + requestModel = client.serialize(requestModelMapper, lab, 'lab'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(lab, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, lab, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (lab === null || lab === undefined) { + throw new Error('lab cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (lab !== null && lab !== undefined) { + let requestModelMapper = new client.models['LabFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, lab, 'lab'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(lab, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Lab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (addUsersPayload === null || addUsersPayload === undefined) { + throw new Error('addUsersPayload cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/addUsers'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (addUsersPayload !== null && addUsersPayload !== undefined) { + let requestModelMapper = new client.models['AddUsersPayload']().mapper(); + requestModel = client.serialize(requestModelMapper, addUsersPayload, 'addUsersPayload'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(addUsersPayload, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _register(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/register'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationLab']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Labs. */ +class Labs { + /** + * Create a Labs. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._addUsers = _addUsers; + this._register = _register; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + } + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List labs in a given lab account. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, options, optionalCallback); + } + } + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=maxUsersInLab)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, lab, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing Lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, lab, options, optionalCallback); + } + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, lab, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of labs. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} lab Represents a lab. + * + * @param {number} [lab.maxUsersInLab] Maximum number of users allowed in the + * lab. + * + * @param {moment.duration} [lab.usageQuota] Maximum duration a user can use an + * environment for in the lab. + * + * @param {string} [lab.userAccessMode] Lab user access mode (open to all vs. + * restricted to those listed on the lab). Possible values include: + * 'Restricted', 'Open' + * + * @param {string} [lab.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [lab.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [lab.location] The location of the resource. + * + * @param {object} [lab.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Lab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Lab} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, lab, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, lab, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, lab, options, optionalCallback); + } + } + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + addUsersWithHttpOperationResponse(resourceGroupName, labAccountName, labName, addUsersPayload, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Add users to a lab + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} addUsersPayload Payload for Add Users operation on a Lab. + * + * @param {array} addUsersPayload.emailAddresses List of user emails addresses + * to add to the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._addUsers(resourceGroupName, labAccountName, labName, addUsersPayload, options, optionalCallback); + } + } + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + registerWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._register(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Register to managed lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + register(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._register(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._register(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete lab. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List labs in a given lab account. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationLab} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationLab} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Labs; diff --git a/lib/services/labservicesManagement/lib/operations/operations.js b/lib/services/labservicesManagement/lib/operations/operations.js new file mode 100644 index 0000000000..6ae1429a4f --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/operations.js @@ -0,0 +1,261 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(locationName, operationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (operationName === null || operationName === undefined || typeof operationName.valueOf() !== 'string') { + throw new Error('operationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{locationName}/operations/{operationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{operationName}', encodeURIComponent(operationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(locationName, operationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(locationName, operationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get operation + * + * @param {string} locationName The name of the location. + * + * @param {string} operationName The name of the operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(locationName, operationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(locationName, operationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(locationName, operationName, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/labservicesManagement/lib/operations/providerOperations.js b/lib/services/labservicesManagement/lib/operations/providerOperations.js new file mode 100644 index 0000000000..0bbc2d4c4a --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/providerOperations.js @@ -0,0 +1,453 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.LabServices/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ProviderOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ProviderOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ProviderOperations. */ +class ProviderOperations { + /** + * Create a ProviderOperations. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Result of the request to list REST API operations + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Result of the request to list REST API operations + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ProviderOperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ProviderOperationResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ProviderOperations; diff --git a/lib/services/labservicesManagement/lib/operations/users.js b/lib/services/labservicesManagement/lib/operations/users.js new file mode 100644 index 0000000000..c1f5532435 --- /dev/null +++ b/lib/services/labservicesManagement/lib/operations/users.js @@ -0,0 +1,1838 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; +const moment = require('moment'); + +/** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, labAccountName, labName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('$orderby=' + encodeURIComponent(orderby)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationUser']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, labAccountName, labName, userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (user === null || user === undefined) { + throw new Error('user cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (user !== null && user !== undefined) { + let requestModelMapper = new client.models['User']().mapper(); + requestModel = client.serialize(requestModelMapper, user, 'user'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(user, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, labAccountName, labName, userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, labAccountName, labName, userName, user, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (user === null || user === undefined) { + throw new Error('user cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (user !== null && user !== undefined) { + let requestModelMapper = new client.models['UserFragment']().mapper(); + requestModel = client.serialize(requestModelMapper, user, 'user'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(user, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['User']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (labAccountName === null || labAccountName === undefined || typeof labAccountName.valueOf() !== 'string') { + throw new Error('labAccountName cannot be null or undefined and it must be of type string.'); + } + if (labName === null || labName === undefined || typeof labName.valueOf() !== 'string') { + throw new Error('labName cannot be null or undefined and it must be of type string.'); + } + if (userName === null || userName === undefined || typeof userName.valueOf() !== 'string') { + throw new Error('userName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{labAccountName}', encodeURIComponent(labAccountName)); + requestUrl = requestUrl.replace('{labName}', encodeURIComponent(labName)); + requestUrl = requestUrl.replace('{userName}', encodeURIComponent(userName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ResponseWithContinuationUser']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Users. */ +class Users { + /** + * Create a Users. + * @param {ManagedLabsClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._beginDeleteMethod = _beginDeleteMethod; + this._listNext = _listNext; + } + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, labAccountName, labName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List users in a given lab. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {string} [options.filter] The filter to apply to the operation. + * + * @param {number} [options.top] The maximum number of resources to return from + * the operation. + * + * @param {string} [options.orderby] The ordering expression for the results, + * using OData notation. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, labAccountName, labName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, labAccountName, labName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, labAccountName, labName, options, optionalCallback); + } + } + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get user + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Specify the $expand query. Example: + * 'properties($select=email)' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, labAccountName, labName, userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, labAccountName, labName, userName, options, optionalCallback); + } + } + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, user, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or replace an existing User. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback); + } + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback); + } + } + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, user, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modify properties of users. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} user The User registered to a lab + * + * @param {string} [user.provisioningState] The provisioning status of the + * resource. + * + * @param {string} [user.uniqueIdentifier] The unique immutable identifier of a + * resource (Guid). + * + * @param {string} [user.location] The location of the resource. + * + * @param {object} [user.tags] The tags of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {User} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link User} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, labAccountName, labName, userName, user, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, labAccountName, labName, userName, user, options, optionalCallback); + } + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, labAccountName, labName, userName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete user. This operation can take a while to complete + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} labAccountName The name of the lab Account. + * + * @param {string} labName The name of the lab. + * + * @param {string} userName The name of the user. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, labAccountName, labName, userName, options, optionalCallback); + } + } + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List users in a given lab. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ResponseWithContinuationUser} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ResponseWithContinuationUser} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Users; diff --git a/lib/services/labservicesManagement/package.json b/lib/services/labservicesManagement/package.json new file mode 100644 index 0000000000..29a3a94b5a --- /dev/null +++ b/lib/services/labservicesManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-labservices", + "author": "Microsoft Corporation", + "description": "ManagedLabsClient Library with typescript type definitions for node", + "version": "1.0.0", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/managedLabsClient.js", + "types": "./lib/managedLabsClient.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/labservicesManagement", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-node/issues" + } +}