From 9661175668b357a90f9521fed06665a5b86ffe06 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 17 Jul 2018 15:50:55 +0000 Subject: [PATCH 1/3] Generated from ba18e00cd5871773dc5db48b6f94d89a94b566a4 Bump hdinsight management Node.js package version to 0.4.0 --- lib/services/hdInsightManagement/LICENSE.txt | 42 +- lib/services/hdInsightManagement/README.md | 84 +- .../lib/hDInsightManagementClient.d.ts | 4 +- .../lib/hDInsightManagementClient.js | 6 +- .../lib/models/application.js | 2 +- .../lib/models/applicationProperties.js | 203 ++ .../lib/models/clusterMonitoringResponse.js | 4 +- .../lib/models/errorResponse.js | 61 + .../hdInsightManagement/lib/models/errors.js | 2 +- .../hdInsightManagement/lib/models/index.d.ts | 243 +- .../hdInsightManagement/lib/models/index.js | 19 +- .../lib/models/localizedName.js | 60 + .../lib/models/operation.js | 2 +- .../lib/models/operationDisplay.js | 2 +- .../lib/models/storageAccount.js | 12 +- .../hdInsightManagement/lib/models/usage.js | 83 + .../lib/models/usagesListResult.js | 62 + .../lib/operations/applications.js | 571 +++-- .../lib/operations/clusters.js | 168 +- .../lib/operations/configurations.js | 149 +- .../lib/operations/extensions.js | 2130 +++++++++++++++++ .../lib/operations/index.d.ts | 487 +++- .../lib/operations/index.js | 4 +- .../lib/operations/locations.js | 252 ++ .../lib/operations/operations.js | 18 +- .../lib/operations/scriptActions.js | 88 +- .../lib/operations/scriptExecutionHistory.js | 83 +- lib/services/hdInsightManagement/package.json | 4 +- 28 files changed, 4083 insertions(+), 762 deletions(-) create mode 100644 lib/services/hdInsightManagement/lib/models/applicationProperties.js create mode 100644 lib/services/hdInsightManagement/lib/models/errorResponse.js create mode 100644 lib/services/hdInsightManagement/lib/models/localizedName.js create mode 100644 lib/services/hdInsightManagement/lib/models/usage.js create mode 100644 lib/services/hdInsightManagement/lib/models/usagesListResult.js create mode 100644 lib/services/hdInsightManagement/lib/operations/extensions.js create mode 100644 lib/services/hdInsightManagement/lib/operations/locations.js diff --git a/lib/services/hdInsightManagement/LICENSE.txt b/lib/services/hdInsightManagement/LICENSE.txt index a70e8cf660..5431ba98b9 100644 --- a/lib/services/hdInsightManagement/LICENSE.txt +++ b/lib/services/hdInsightManagement/LICENSE.txt @@ -1,21 +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. +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/hdInsightManagement/README.md b/lib/services/hdInsightManagement/README.md index d3c7f6e42f..3f1c3b8d46 100644 --- a/lib/services/hdInsightManagement/README.md +++ b/lib/services/hdInsightManagement/README.md @@ -1,42 +1,42 @@ ---- -uid: azure-arm-hdinsight -summary: *content - ---- -# Microsoft Azure SDK for Node.js - HDInsightManagementClient -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-hdinsight -``` - -## How to use - -### Authentication, client creation and get clusters as an example. - -```javascript -const msRestAzure = require("ms-rest-azure"); -const HDInsightManagementClient = require("azure-arm-hdinsight"); -msRestAzure.interactiveLogin().then((creds) => { - const subscriptionId = ""; - const client = new HDInsightManagementClient(creds, subscriptionId); - const resourceGroupName = "testresourceGroupName"; - const clusterName = "testclusterName"; - return client.clusters.get(resourceGroupName, clusterName).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) +--- +uid: azure-arm-hdinsight +summary: *content + +--- +# Microsoft Azure SDK for Node.js - HDInsightManagementClient +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-hdinsight +``` + +## How to use + +### Authentication, client creation and get clusters as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const HDInsightManagementClient = require("azure-arm-hdinsight"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new HDInsightManagementClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const clusterName = "testclusterName"; + return client.clusters.get(resourceGroupName, clusterName).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/hdInsightManagement/lib/hDInsightManagementClient.d.ts b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.d.ts index f2e6692fa6..6e2ce8a6ec 100644 --- a/lib/services/hdInsightManagement/lib/hDInsightManagementClient.d.ts +++ b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.d.ts @@ -58,9 +58,9 @@ export default class HDInsightManagementClient extends AzureServiceClient { // Operation groups clusters: operations.Clusters; applications: operations.Applications; - location: operations.Location; + locations: operations.Locations; configurations: operations.Configurations; - extensionOperations: operations.ExtensionOperations; + extensions: operations.Extensions; scriptActions: operations.ScriptActions; scriptExecutionHistory: operations.ScriptExecutionHistory; operations: operations.Operations; diff --git a/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js index 85ee8630ea..9adc73f697 100644 --- a/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js +++ b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js @@ -50,7 +50,7 @@ class HDInsightManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2015-03-01-preview'; + this.apiVersion = '2018-06-01-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -74,9 +74,9 @@ class HDInsightManagementClient extends ServiceClient { } this.clusters = new operations.Clusters(this); this.applications = new operations.Applications(this); - this.location = new operations.Location(this); + this.locations = new operations.Locations(this); this.configurations = new operations.Configurations(this); - this.extensionOperations = new operations.ExtensionOperations(this); + this.extensions = new operations.Extensions(this); this.scriptActions = new operations.ScriptActions(this); this.scriptExecutionHistory = new operations.ScriptExecutionHistory(this); this.operations = new operations.Operations(this); diff --git a/lib/services/hdInsightManagement/lib/models/application.js b/lib/services/hdInsightManagement/lib/models/application.js index 1def973914..b56f73682d 100644 --- a/lib/services/hdInsightManagement/lib/models/application.js +++ b/lib/services/hdInsightManagement/lib/models/application.js @@ -115,7 +115,7 @@ class Application extends models['ProxyResource'] { serializedName: 'properties', type: { name: 'Composite', - className: 'ApplicationGetProperties' + className: 'ApplicationProperties' } } } diff --git a/lib/services/hdInsightManagement/lib/models/applicationProperties.js b/lib/services/hdInsightManagement/lib/models/applicationProperties.js new file mode 100644 index 0000000000..16e379c10b --- /dev/null +++ b/lib/services/hdInsightManagement/lib/models/applicationProperties.js @@ -0,0 +1,203 @@ +/* + * 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 HDInsight cluster application GET response. + * + */ +class ApplicationProperties { + /** + * Create a ApplicationProperties. + * @member {object} [computeProfile] The list of roles in the cluster. + * @member {array} [computeProfile.roles] The list of roles in the cluster. + * @member {array} [installScriptActions] The list of install script actions. + * @member {array} [uninstallScriptActions] The list of uninstall script + * actions. + * @member {array} [httpsEndpoints] The list of application HTTPS endpoints. + * @member {array} [sshEndpoints] The list of application SSH endpoints. + * @member {string} [provisioningState] The provisioning state of the + * application. + * @member {string} [applicationType] The application type. + * @member {string} [applicationState] The application state. + * @member {array} [errors] The list of errors. + * @member {string} [createdDate] The application create date time. + * @member {string} [marketplaceIdentifier] The marketplace identifier. + * @member {string} [additionalProperties] The additional properties for + * application. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationProperties + * + * @returns {object} metadata of ApplicationProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationProperties', + type: { + name: 'Composite', + className: 'ApplicationProperties', + modelProperties: { + computeProfile: { + required: false, + serializedName: 'computeProfile', + type: { + name: 'Composite', + className: 'ComputeProfile' + } + }, + installScriptActions: { + required: false, + serializedName: 'installScriptActions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RuntimeScriptActionElementType', + type: { + name: 'Composite', + className: 'RuntimeScriptAction' + } + } + } + }, + uninstallScriptActions: { + required: false, + serializedName: 'uninstallScriptActions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RuntimeScriptActionElementType', + type: { + name: 'Composite', + className: 'RuntimeScriptAction' + } + } + } + }, + httpsEndpoints: { + required: false, + serializedName: 'httpsEndpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGetHttpsEndpointElementType', + type: { + name: 'Composite', + additionalProperties: { + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + className: 'ApplicationGetHttpsEndpoint' + } + } + } + }, + sshEndpoints: { + required: false, + serializedName: 'sshEndpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGetEndpointElementType', + type: { + name: 'Composite', + className: 'ApplicationGetEndpoint' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + }, + applicationType: { + required: false, + serializedName: 'applicationType', + type: { + name: 'String' + } + }, + applicationState: { + required: false, + readOnly: true, + serializedName: 'applicationState', + type: { + name: 'String' + } + }, + errors: { + required: false, + serializedName: 'errors', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorsElementType', + type: { + name: 'Composite', + className: 'Errors' + } + } + } + }, + createdDate: { + required: false, + readOnly: true, + serializedName: 'createdDate', + type: { + name: 'String' + } + }, + marketplaceIdentifier: { + required: false, + readOnly: true, + serializedName: 'marketplaceIdentifier', + type: { + name: 'String' + } + }, + additionalProperties: { + required: false, + serializedName: 'additionalProperties', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationProperties; diff --git a/lib/services/hdInsightManagement/lib/models/clusterMonitoringResponse.js b/lib/services/hdInsightManagement/lib/models/clusterMonitoringResponse.js index b6ffbcee4c..31ff720c34 100644 --- a/lib/services/hdInsightManagement/lib/models/clusterMonitoringResponse.js +++ b/lib/services/hdInsightManagement/lib/models/clusterMonitoringResponse.js @@ -41,14 +41,14 @@ class ClusterMonitoringResponse { modelProperties: { clusterMonitoringEnabled: { required: false, - serializedName: 'ClusterMonitoringEnabled', + serializedName: 'clusterMonitoringEnabled', type: { name: 'Boolean' } }, workspaceId: { required: false, - serializedName: 'WorkspaceId', + serializedName: 'workspaceId', type: { name: 'String' } diff --git a/lib/services/hdInsightManagement/lib/models/errorResponse.js b/lib/services/hdInsightManagement/lib/models/errorResponse.js new file mode 100644 index 0000000000..f952d62061 --- /dev/null +++ b/lib/services/hdInsightManagement/lib/models/errorResponse.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'; + +/** + * Describes the format of Error response. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/hdInsightManagement/lib/models/errors.js b/lib/services/hdInsightManagement/lib/models/errors.js index a81c3e7196..ab1430cd14 100644 --- a/lib/services/hdInsightManagement/lib/models/errors.js +++ b/lib/services/hdInsightManagement/lib/models/errors.js @@ -32,7 +32,7 @@ class Errors { mapper() { return { required: false, - serializedName: 'errors', + serializedName: 'Errors', type: { name: 'Composite', className: 'Errors', diff --git a/lib/services/hdInsightManagement/lib/models/index.d.ts b/lib/services/hdInsightManagement/lib/models/index.d.ts index 742ce262ed..b1854aa78d 100644 --- a/lib/services/hdInsightManagement/lib/models/index.d.ts +++ b/lib/services/hdInsightManagement/lib/models/index.d.ts @@ -245,13 +245,17 @@ export interface ComputeProfile { * @member {string} [name] The name of the storage account. * @member {boolean} [isDefault] Whether or not the storage account is the * default storage account. - * @member {string} [container] The container in the storage account. + * @member {string} [container] The container in the storage account, only to + * be specified for WASB storage accounts. + * @member {string} [fileSystem] The filesystem, only to be specified for Azure + * Data Lake Storage type Gen 2. * @member {string} [key] The storage account access key. */ export interface StorageAccount { name?: string; isDefault?: boolean; container?: string; + fileSystem?: string; key?: string; } @@ -721,40 +725,17 @@ export interface ProxyResource extends Resource { /** * @class - * Initializes a new instance of the OperationDisplay class. - * @constructor - * The object that represents the operation. - * - * @member {string} [provider] The service provider: Microsoft.HDInsight - * @member {string} [resource] The resource on which the operation is - * performed: Cluster, Capabilities, etc. - * @member {string} [operation] The operation type: read, write, delete, etc. - */ -export interface OperationDisplay { - provider?: string; - resource?: string; - operation?: string; -} - -/** - * @class - * Initializes a new instance of the Operation class. + * Initializes a new instance of the ErrorResponse class. * @constructor - * The HDInsight REST API operation. + * Describes the format of Error response. * - * @member {string} [name] The operation name: - * {provider}/{resource}/{operation} - * @member {object} [display] The object that represents the operation. - * @member {string} [display.provider] The service provider: - * Microsoft.HDInsight - * @member {string} [display.resource] The resource on which the operation is - * performed: Cluster, Capabilities, etc. - * @member {string} [display.operation] The operation type: read, write, - * delete, etc. + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. */ -export interface Operation { - name?: string; - display?: OperationDisplay; +export interface ErrorResponse { + code?: string; + message?: string; } /** @@ -799,7 +780,7 @@ export interface ApplicationGetEndpoint { /** * @class - * Initializes a new instance of the ApplicationGetProperties class. + * Initializes a new instance of the ApplicationProperties class. * @constructor * The HDInsight cluster application GET response. * @@ -820,7 +801,7 @@ export interface ApplicationGetEndpoint { * @member {string} [additionalProperties] The additional properties for * application. */ -export interface ApplicationGetProperties { +export interface ApplicationProperties { computeProfile?: ComputeProfile; installScriptActions?: RuntimeScriptAction[]; uninstallScriptActions?: RuntimeScriptAction[]; @@ -870,155 +851,55 @@ export interface ApplicationGetProperties { export interface Application extends ProxyResource { etag?: string; tags?: { [propertyName: string]: string }; - properties?: ApplicationGetProperties; -} - -/** - * @class - * Initializes a new instance of the VersionSpec class. - * @constructor - * The version properties. - * - * @member {string} [friendlyName] The friendly name - * @member {string} [displayName] The display name - * @member {string} [isDefault] Whether or not the version is the default - * version. - * @member {object} [componentVersions] The component version property. - */ -export interface VersionSpec { - friendlyName?: string; - displayName?: string; - isDefault?: string; - componentVersions?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the VersionsCapability class. - * @constructor - * The version capability. - * - * @member {array} [available] The list of version capabilities. - */ -export interface VersionsCapability { - available?: VersionSpec[]; -} - -/** - * @class - * Initializes a new instance of the RegionsCapability class. - * @constructor - * The regions capability. - * - * @member {array} [available] The list of region capabilities. - */ -export interface RegionsCapability { - available?: string[]; -} - -/** - * @class - * Initializes a new instance of the VmSizesCapability class. - * @constructor - * The virtual machine sizes capability. - * - * @member {array} [available] The list of virtual machine size capabilities. - */ -export interface VmSizesCapability { - available?: string[]; -} - -/** - * @class - * Initializes a new instance of the VmSizeCompatibilityFilter class. - * @constructor - * The virtual machine type compatibility filter. - * - * @member {string} [filterMode] The mode for the filter. - * @member {array} [regions] The list of regions. - * @member {array} [clusterFlavors] The list of cluster types available. - * @member {array} [nodeTypes] The list of node types. - * @member {array} [clusterVersions] The list of cluster versions. - * @member {array} [vmsizes] The list of virtual machine sizes. - */ -export interface VmSizeCompatibilityFilter { - filterMode?: string; - regions?: string[]; - clusterFlavors?: string[]; - nodeTypes?: string[]; - clusterVersions?: string[]; - vmsizes?: string[]; -} - -/** - * @class - * Initializes a new instance of the RegionalQuotaCapability class. - * @constructor - * The regional quota capacity. - * - * @member {string} [regionName] The region name. - * @member {number} [coresUsed] The number of cores used in the region. - * @member {number} [coresAvailable] The number of courses available in the - * region. - */ -export interface RegionalQuotaCapability { - regionName?: string; - coresUsed?: number; - coresAvailable?: number; + properties?: ApplicationProperties; } /** * @class - * Initializes a new instance of the QuotaCapability class. + * Initializes a new instance of the LocalizedName class. * @constructor - * The regional quota capability. + * The details about the localizable name of a type of usage. * - * @member {array} [regionalQuotas] The list of region quota capabilities. + * @member {string} [value] The name of the used resource. + * @member {string} [localizedValue] The localized name of the used resource. */ -export interface QuotaCapability { - regionalQuotas?: RegionalQuotaCapability[]; +export interface LocalizedName { + value?: string; + localizedValue?: string; } /** * @class - * Initializes a new instance of the CapabilitiesResult class. + * Initializes a new instance of the Usage class. * @constructor - * The Get Capabilities operation response. + * The details about the usage of a particular limited resource. * - * @member {object} [versions] The version capability. - * @member {object} [regions] The virtual machine size compatibilty features. - * @member {object} [vmSizes] The virtual machine sizes. - * @member {array} [vmSizeFilters] The virtual machine size compatibilty - * filters. - * @member {array} [features] The capabilty features. - * @member {object} [quota] The quota capability. - * @member {array} [quota.regionalQuotas] The list of region quota - * capabilities. + * @member {string} [unit] The type of measurement for usage. + * @member {number} [currentValue] The current usage. + * @member {number} [limit] The maximum allowed usage. + * @member {object} [name] The details about the localizable name of the used + * resource. + * @member {string} [name.value] The name of the used resource. + * @member {string} [name.localizedValue] The localized name of the used + * resource. */ -export interface CapabilitiesResult { - versions?: { [propertyName: string]: VersionsCapability }; - regions?: { [propertyName: string]: RegionsCapability }; - vmSizes?: { [propertyName: string]: VmSizesCapability }; - vmSizeFilters?: VmSizeCompatibilityFilter[]; - features?: string[]; - quota?: QuotaCapability; +export interface Usage { + unit?: string; + currentValue?: number; + limit?: number; + name?: LocalizedName; } /** * @class - * Initializes a new instance of the HttpConnectivitySettings class. + * Initializes a new instance of the UsagesListResult class. * @constructor - * The payload for a Configure HTTP settings request. + * The response for the operation to get regional usages for a subscription. * - * @member {string} [enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * @member {string} [username] The HTTP username. - * @member {string} [password] The HTTP user password. + * @member {array} [value] The list of usages. */ -export interface HttpConnectivitySettings { - enabledCredential?: string; - username?: string; - password?: string; +export interface UsagesListResult { + value?: Usage[]; } /** @@ -1090,6 +971,44 @@ export interface ScriptActionPersistedGetResponseSpec { applicationName?: string; } +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * The object that represents the operation. + * + * @member {string} [provider] The service provider: Microsoft.HDInsight + * @member {string} [resource] The resource on which the operation is + * performed: Cluster, Applications, etc. + * @member {string} [operation] The operation type: read, write, delete, etc. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * The HDInsight REST API operation. + * + * @member {string} [name] The operation name: + * {provider}/{resource}/{operation} + * @member {object} [display] The object that represents the operation. + * @member {string} [display.provider] The service provider: + * Microsoft.HDInsight + * @member {string} [display.resource] The resource on which the operation is + * performed: Cluster, Applications, etc. + * @member {string} [display.operation] The operation type: read, write, + * delete, etc. + */ +export interface Operation { + name?: string; + display?: OperationDisplay; +} + /** * @class diff --git a/lib/services/hdInsightManagement/lib/models/index.js b/lib/services/hdInsightManagement/lib/models/index.js index 76b2ff7844..5479f7cd86 100644 --- a/lib/services/hdInsightManagement/lib/models/index.js +++ b/lib/services/hdInsightManagement/lib/models/index.js @@ -51,25 +51,20 @@ exports.ClusterListRuntimeScriptActionDetailResult = require('./clusterListRunti exports.ClusterResizeParameters = require('./clusterResizeParameters'); exports.OperationResource = require('./operationResource'); exports.ProxyResource = require('./proxyResource'); -exports.OperationDisplay = require('./operationDisplay'); -exports.Operation = require('./operation'); +exports.ErrorResponse = require('./errorResponse'); exports.ApplicationGetHttpsEndpoint = require('./applicationGetHttpsEndpoint'); exports.ApplicationGetEndpoint = require('./applicationGetEndpoint'); -exports.ApplicationGetProperties = require('./applicationGetProperties'); +exports.ApplicationProperties = require('./applicationProperties'); exports.Application = require('./application'); -exports.VersionSpec = require('./versionSpec'); -exports.VersionsCapability = require('./versionsCapability'); -exports.RegionsCapability = require('./regionsCapability'); -exports.VmSizesCapability = require('./vmSizesCapability'); -exports.VmSizeCompatibilityFilter = require('./vmSizeCompatibilityFilter'); -exports.RegionalQuotaCapability = require('./regionalQuotaCapability'); -exports.QuotaCapability = require('./quotaCapability'); -exports.CapabilitiesResult = require('./capabilitiesResult'); -exports.HttpConnectivitySettings = require('./httpConnectivitySettings'); +exports.LocalizedName = require('./localizedName'); +exports.Usage = require('./usage'); +exports.UsagesListResult = require('./usagesListResult'); exports.Extension = require('./extension'); exports.ClusterMonitoringResponse = require('./clusterMonitoringResponse'); exports.ClusterMonitoringRequest = require('./clusterMonitoringRequest'); exports.ScriptActionPersistedGetResponseSpec = require('./scriptActionPersistedGetResponseSpec'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); exports.ClusterListResult = require('./clusterListResult'); exports.ApplicationListResult = require('./applicationListResult'); exports.ScriptActionsList = require('./scriptActionsList'); diff --git a/lib/services/hdInsightManagement/lib/models/localizedName.js b/lib/services/hdInsightManagement/lib/models/localizedName.js new file mode 100644 index 0000000000..e293961473 --- /dev/null +++ b/lib/services/hdInsightManagement/lib/models/localizedName.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'; + +/** + * The details about the localizable name of a type of usage. + * + */ +class LocalizedName { + /** + * Create a LocalizedName. + * @member {string} [value] The name of the used resource. + * @member {string} [localizedValue] The localized name of the used resource. + */ + constructor() { + } + + /** + * Defines the metadata of LocalizedName + * + * @returns {object} metadata of LocalizedName + * + */ + mapper() { + return { + required: false, + serializedName: 'LocalizedName', + type: { + name: 'Composite', + className: 'LocalizedName', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + }, + localizedValue: { + required: false, + serializedName: 'localizedValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LocalizedName; diff --git a/lib/services/hdInsightManagement/lib/models/operation.js b/lib/services/hdInsightManagement/lib/models/operation.js index 41bd23aec0..7caf630893 100644 --- a/lib/services/hdInsightManagement/lib/models/operation.js +++ b/lib/services/hdInsightManagement/lib/models/operation.js @@ -25,7 +25,7 @@ class Operation { * @member {string} [display.provider] The service provider: * Microsoft.HDInsight * @member {string} [display.resource] The resource on which the operation is - * performed: Cluster, Capabilities, etc. + * performed: Cluster, Applications, etc. * @member {string} [display.operation] The operation type: read, write, * delete, etc. */ diff --git a/lib/services/hdInsightManagement/lib/models/operationDisplay.js b/lib/services/hdInsightManagement/lib/models/operationDisplay.js index 49107d1a37..1bbb9f1f22 100644 --- a/lib/services/hdInsightManagement/lib/models/operationDisplay.js +++ b/lib/services/hdInsightManagement/lib/models/operationDisplay.js @@ -19,7 +19,7 @@ class OperationDisplay { * Create a OperationDisplay. * @member {string} [provider] The service provider: Microsoft.HDInsight * @member {string} [resource] The resource on which the operation is - * performed: Cluster, Capabilities, etc. + * performed: Cluster, Applications, etc. * @member {string} [operation] The operation type: read, write, delete, etc. */ constructor() { diff --git a/lib/services/hdInsightManagement/lib/models/storageAccount.js b/lib/services/hdInsightManagement/lib/models/storageAccount.js index 3132775b47..b7aa335f48 100644 --- a/lib/services/hdInsightManagement/lib/models/storageAccount.js +++ b/lib/services/hdInsightManagement/lib/models/storageAccount.js @@ -20,7 +20,10 @@ class StorageAccount { * @member {string} [name] The name of the storage account. * @member {boolean} [isDefault] Whether or not the storage account is the * default storage account. - * @member {string} [container] The container in the storage account. + * @member {string} [container] The container in the storage account, only to + * be specified for WASB storage accounts. + * @member {string} [fileSystem] The filesystem, only to be specified for + * Azure Data Lake Storage type Gen 2. * @member {string} [key] The storage account access key. */ constructor() { @@ -61,6 +64,13 @@ class StorageAccount { name: 'String' } }, + fileSystem: { + required: false, + serializedName: 'fileSystem', + type: { + name: 'String' + } + }, key: { required: false, serializedName: 'key', diff --git a/lib/services/hdInsightManagement/lib/models/usage.js b/lib/services/hdInsightManagement/lib/models/usage.js new file mode 100644 index 0000000000..e7af1b22cb --- /dev/null +++ b/lib/services/hdInsightManagement/lib/models/usage.js @@ -0,0 +1,83 @@ +/* + * 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 details about the usage of a particular limited resource. + * + */ +class Usage { + /** + * Create a Usage. + * @member {string} [unit] The type of measurement for usage. + * @member {number} [currentValue] The current usage. + * @member {number} [limit] The maximum allowed usage. + * @member {object} [name] The details about the localizable name of the used + * resource. + * @member {string} [name.value] The name of the used resource. + * @member {string} [name.localizedValue] The localized name of the used + * resource. + */ + constructor() { + } + + /** + * Defines the metadata of Usage + * + * @returns {object} metadata of Usage + * + */ + mapper() { + return { + required: false, + serializedName: 'Usage', + type: { + name: 'Composite', + className: 'Usage', + modelProperties: { + unit: { + required: false, + serializedName: 'unit', + type: { + name: 'String' + } + }, + currentValue: { + required: false, + serializedName: 'currentValue', + type: { + name: 'Number' + } + }, + limit: { + required: false, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizedName' + } + } + } + } + }; + } +} + +module.exports = Usage; diff --git a/lib/services/hdInsightManagement/lib/models/usagesListResult.js b/lib/services/hdInsightManagement/lib/models/usagesListResult.js new file mode 100644 index 0000000000..948dab635c --- /dev/null +++ b/lib/services/hdInsightManagement/lib/models/usagesListResult.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'; + +const models = require('./index'); + +/** + * The response for the operation to get regional usages for a subscription. + * + */ +class UsagesListResult { + /** + * Create a UsagesListResult. + * @member {array} [value] The list of usages. + */ + constructor() { + } + + /** + * Defines the metadata of UsagesListResult + * + * @returns {object} metadata of UsagesListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'UsagesListResult', + type: { + name: 'Composite', + className: 'UsagesListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UsageElementType', + type: { + name: 'Composite', + className: 'Usage' + } + } + } + } + } + } + }; + } +} + +module.exports = UsagesListResult; diff --git a/lib/services/hdInsightManagement/lib/operations/applications.js b/lib/services/hdInsightManagement/lib/operations/applications.js index 96f44d3f4a..6d031ddc04 100644 --- a/lib/services/hdInsightManagement/lib/operations/applications.js +++ b/lib/services/hdInsightManagement/lib/operations/applications.js @@ -15,7 +15,7 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -39,7 +39,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _list(resourceGroupName, clusterName, options, callback) { +function _listByCluster(resourceGroupName, clusterName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -51,6 +51,9 @@ function _list(resourceGroupName, clusterName, options, callback) { } // 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.'); } @@ -60,9 +63,6 @@ function _list(resourceGroupName, clusterName, options, callback) { 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.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 (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.'); } @@ -73,9 +73,9 @@ function _list(resourceGroupName, clusterName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -119,12 +119,13 @@ function _list(resourceGroupName, clusterName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -160,7 +161,7 @@ function _list(resourceGroupName, clusterName, options, callback) { } /** - * Lists properties of the specified application. + * Gets properties of the specified application. * * @param {string} resourceGroupName The name of the resource group. * @@ -198,21 +199,21 @@ function _get(resourceGroupName, clusterName, applicationName, options, callback } // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName 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.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 (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { throw new Error('applicationName 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.'); } @@ -223,9 +224,9 @@ function _get(resourceGroupName, clusterName, applicationName, options, callback // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{applicationName}', encodeURIComponent(applicationName)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); @@ -270,12 +271,13 @@ function _get(resourceGroupName, clusterName, applicationName, options, callback 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -310,6 +312,7 @@ function _get(resourceGroupName, clusterName, applicationName, options, callback }); } + /** * Creates applications for the HDInsight cluster. * @@ -317,6 +320,8 @@ function _get(resourceGroupName, clusterName, applicationName, options, callback * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} parameters The application create request. * * @param {object} [parameters.computeProfile] The list of roles in the @@ -362,7 +367,178 @@ function _get(resourceGroupName, clusterName, applicationName, options, callback * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, clusterName, parameters, options, callback) { +function _create(resourceGroupName, clusterName, applicationName, parameters, 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.beginCreate(resourceGroupName, clusterName, applicationName, parameters, 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['Application']().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); + }); + }); +} + + +/** + * Deletes the specified application on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} applicationName The constant value for the application name. + * + * @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, clusterName, applicationName, 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, clusterName, applicationName, 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); + }); + }); +} + +/** + * Creates applications for the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} applicationName The constant value for the application name. + * + * @param {object} parameters The application create request. + * + * @param {object} [parameters.computeProfile] The list of roles in the + * cluster. + * + * @param {array} [parameters.computeProfile.roles] The list of roles in the + * cluster. + * + * @param {array} [parameters.installScriptActions] The list of install script + * actions. + * + * @param {array} [parameters.uninstallScriptActions] The list of uninstall + * script actions. + * + * @param {array} [parameters.httpsEndpoints] The list of application HTTPS + * endpoints. + * + * @param {array} [parameters.sshEndpoints] The list of application SSH + * endpoints. + * + * @param {string} [parameters.applicationType] The application type. + * + * @param {array} [parameters.errors] The list of errors. + * + * @param {string} [parameters.additionalProperties] The additional properties + * for application. + * + * @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 Application} 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 _beginCreate(resourceGroupName, clusterName, applicationName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -372,23 +548,25 @@ function _create(resourceGroupName, clusterName, parameters, options, callback) if (!callback) { throw new Error('callback cannot be null.'); } - let applicationName = 'hue'; // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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.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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); } 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.'); @@ -400,10 +578,10 @@ function _create(resourceGroupName, clusterName, parameters, options, callback) // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); requestUrl = requestUrl.replace('{applicationName}', encodeURIComponent(applicationName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -435,7 +613,7 @@ function _create(resourceGroupName, clusterName, parameters, options, callback) let requestModel = null; try { if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ApplicationGetProperties']().mapper(); + let requestModelMapper = new client.models['ApplicationProperties']().mapper(); requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -461,12 +639,13 @@ function _create(resourceGroupName, clusterName, parameters, options, callback) 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -501,7 +680,6 @@ function _create(resourceGroupName, clusterName, parameters, options, callback) }); } - /** * Deletes the specified application on the HDInsight cluster. * @@ -509,67 +687,7 @@ function _create(resourceGroupName, clusterName, parameters, options, callback) * * @param {string} clusterName The name of the cluster. * - * @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, clusterName, 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, clusterName, 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); - }); - }); -} - -/** - * Deletes the specified application on the HDInsight cluster. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} clusterName The name of the cluster. + * @param {string} applicationName The constant value for the application name. * * @param {object} [options] Optional Parameters. * @@ -588,7 +706,7 @@ function _deleteMethod(resourceGroupName, clusterName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { +function _beginDeleteMethod(resourceGroupName, clusterName, applicationName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -598,21 +716,23 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let applicationName = 'hue'; // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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.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 (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.'); } @@ -623,10 +743,10 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); requestUrl = requestUrl.replace('{applicationName}', encodeURIComponent(applicationName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -660,7 +780,7 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -670,12 +790,13 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -694,7 +815,7 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { } /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -717,7 +838,7 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listNext(nextPageLink, options, callback) { +function _listByClusterNext(nextPageLink, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -780,12 +901,13 @@ function _listNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -828,16 +950,17 @@ class Applications { */ constructor(client) { this.client = client; - this._list = _list; + this._listByCluster = _listByCluster; this._get = _get; this._create = _create; this._deleteMethod = _deleteMethod; + this._beginCreate = _beginCreate; this._beginDeleteMethod = _beginDeleteMethod; - this._listNext = _listNext; + this._listByClusterNext = _listByClusterNext; } /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -854,11 +977,11 @@ class Applications { * * @reject {Error} - The error object. */ - listWithHttpOperationResponse(resourceGroupName, clusterName, options) { + listByClusterWithHttpOperationResponse(resourceGroupName, clusterName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._list(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._listByCluster(resourceGroupName, clusterName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -869,7 +992,7 @@ class Applications { } /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -902,7 +1025,7 @@ class Applications { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - list(resourceGroupName, clusterName, options, optionalCallback) { + listByCluster(resourceGroupName, clusterName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -911,19 +1034,19 @@ class Applications { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._list(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._listByCluster(resourceGroupName, clusterName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._list(resourceGroupName, clusterName, options, optionalCallback); + return self._listByCluster(resourceGroupName, clusterName, options, optionalCallback); } } /** - * Lists properties of the specified application. + * Gets properties of the specified application. * * @param {string} resourceGroupName The name of the resource group. * @@ -957,7 +1080,7 @@ class Applications { } /** - * Lists properties of the specified application. + * Gets properties of the specified application. * * @param {string} resourceGroupName The name of the resource group. * @@ -1019,6 +1142,8 @@ class Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} parameters The application create request. * * @param {object} [parameters.computeProfile] The list of roles in the @@ -1057,11 +1182,11 @@ class Applications { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) { + createWithHttpOperationResponse(resourceGroupName, clusterName, applicationName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + self._create(resourceGroupName, clusterName, applicationName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1078,6 +1203,8 @@ class Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} parameters The application create request. * * @param {object} [parameters.computeProfile] The list of roles in the @@ -1132,7 +1259,7 @@ class Applications { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, clusterName, parameters, options, optionalCallback) { + create(resourceGroupName, clusterName, applicationName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1141,14 +1268,14 @@ class Applications { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + self._create(resourceGroupName, clusterName, applicationName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, clusterName, parameters, options, optionalCallback); + return self._create(resourceGroupName, clusterName, applicationName, parameters, options, optionalCallback); } } @@ -1159,6 +1286,8 @@ class Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1170,11 +1299,11 @@ class Applications { * * @reject {Error} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName, clusterName, options) { + deleteMethodWithHttpOperationResponse(resourceGroupName, clusterName, applicationName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, clusterName, applicationName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1191,6 +1320,8 @@ class Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1217,7 +1348,151 @@ class Applications { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName, clusterName, options, optionalCallback) { + deleteMethod(resourceGroupName, clusterName, applicationName, 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, clusterName, applicationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, clusterName, applicationName, options, optionalCallback); + } + } + + /** + * Creates applications for the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} applicationName The constant value for the application name. + * + * @param {object} parameters The application create request. + * + * @param {object} [parameters.computeProfile] The list of roles in the + * cluster. + * + * @param {array} [parameters.computeProfile.roles] The list of roles in the + * cluster. + * + * @param {array} [parameters.installScriptActions] The list of install script + * actions. + * + * @param {array} [parameters.uninstallScriptActions] The list of uninstall + * script actions. + * + * @param {array} [parameters.httpsEndpoints] The list of application HTTPS + * endpoints. + * + * @param {array} [parameters.sshEndpoints] The list of application SSH + * endpoints. + * + * @param {string} [parameters.applicationType] The application type. + * + * @param {array} [parameters.errors] The list of errors. + * + * @param {string} [parameters.additionalProperties] The additional properties + * for application. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, clusterName, applicationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, clusterName, applicationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates applications for the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} applicationName The constant value for the application name. + * + * @param {object} parameters The application create request. + * + * @param {object} [parameters.computeProfile] The list of roles in the + * cluster. + * + * @param {array} [parameters.computeProfile.roles] The list of roles in the + * cluster. + * + * @param {array} [parameters.installScriptActions] The list of install script + * actions. + * + * @param {array} [parameters.uninstallScriptActions] The list of uninstall + * script actions. + * + * @param {array} [parameters.httpsEndpoints] The list of application HTTPS + * endpoints. + * + * @param {array} [parameters.sshEndpoints] The list of application SSH + * endpoints. + * + * @param {string} [parameters.applicationType] The application type. + * + * @param {array} [parameters.errors] The list of errors. + * + * @param {string} [parameters.additionalProperties] The additional properties + * for application. + * + * @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 {Application} - 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 Application} 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. + */ + beginCreate(resourceGroupName, clusterName, applicationName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1226,14 +1501,14 @@ class Applications { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, clusterName, applicationName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteMethod(resourceGroupName, clusterName, options, optionalCallback); + return self._beginCreate(resourceGroupName, clusterName, applicationName, parameters, options, optionalCallback); } } @@ -1244,6 +1519,8 @@ class Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1255,11 +1532,11 @@ class Applications { * * @reject {Error} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName, clusterName, options) { + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, clusterName, applicationName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginDeleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, clusterName, applicationName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1276,6 +1553,8 @@ class Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1302,7 +1581,7 @@ class Applications { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName, clusterName, options, optionalCallback) { + beginDeleteMethod(resourceGroupName, clusterName, applicationName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1311,19 +1590,19 @@ class Applications { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginDeleteMethod(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, clusterName, applicationName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginDeleteMethod(resourceGroupName, clusterName, options, optionalCallback); + return self._beginDeleteMethod(resourceGroupName, clusterName, applicationName, options, optionalCallback); } } /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1339,11 +1618,11 @@ class Applications { * * @reject {Error} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink, options) { + listByClusterNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { + self._listByClusterNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1354,7 +1633,7 @@ class Applications { } /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1386,7 +1665,7 @@ class Applications { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listNext(nextPageLink, options, optionalCallback) { + listByClusterNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1395,14 +1674,14 @@ class Applications { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { + self._listByClusterNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listNext(nextPageLink, options, optionalCallback); + return self._listByClusterNext(nextPageLink, options, optionalCallback); } } diff --git a/lib/services/hdInsightManagement/lib/operations/clusters.js b/lib/services/hdInsightManagement/lib/operations/clusters.js index f208d4908f..20fc2dfc70 100644 --- a/lib/services/hdInsightManagement/lib/operations/clusters.js +++ b/lib/services/hdInsightManagement/lib/operations/clusters.js @@ -200,20 +200,20 @@ function _update(resourceGroupName, clusterName, parameters, options, callback) } // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters 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.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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); } 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.'); @@ -225,9 +225,9 @@ function _update(resourceGroupName, clusterName, parameters, options, callback) // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -285,12 +285,13 @@ function _update(resourceGroupName, clusterName, parameters, options, callback) 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -425,6 +426,9 @@ function _get(resourceGroupName, clusterName, options, callback) { } // 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.'); } @@ -434,9 +438,6 @@ function _get(resourceGroupName, clusterName, options, callback) { 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.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 (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.'); } @@ -447,9 +448,9 @@ function _get(resourceGroupName, clusterName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -493,12 +494,13 @@ function _get(resourceGroupName, clusterName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -568,15 +570,15 @@ function _listByResourceGroup(resourceGroupName, options, callback) { } // 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 (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.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 (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.'); } @@ -587,8 +589,8 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -632,12 +634,13 @@ function _listByResourceGroup(resourceGroupName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -773,12 +776,12 @@ function _list(options, callback) { } // 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.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 (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.'); } @@ -833,12 +836,13 @@ function _list(options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1048,20 +1052,20 @@ function _beginCreate(resourceGroupName, clusterName, parameters, options, callb } // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters 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.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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); } 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.'); @@ -1073,9 +1077,9 @@ function _beginCreate(resourceGroupName, clusterName, parameters, options, callb // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1133,12 +1137,13 @@ function _beginCreate(resourceGroupName, clusterName, parameters, options, callb 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1209,6 +1214,9 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { } // 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.'); } @@ -1218,9 +1226,6 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { 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.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 (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.'); } @@ -1231,9 +1236,9 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1277,12 +1282,13 @@ function _beginDeleteMethod(resourceGroupName, clusterName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1342,20 +1348,20 @@ function _beginResize(resourceGroupName, clusterName, parameters, options, callb let roleName = 'workernode'; // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters 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.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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); } 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.'); @@ -1367,10 +1373,10 @@ function _beginResize(resourceGroupName, clusterName, parameters, options, callb // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); requestUrl = requestUrl.replace('{roleName}', encodeURIComponent(roleName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1428,12 +1434,13 @@ function _beginResize(resourceGroupName, clusterName, parameters, options, callb 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1495,20 +1502,20 @@ function _beginExecuteScriptActions(resourceGroupName, clusterName, parameters, } // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters 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.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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); } 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.'); @@ -1520,9 +1527,9 @@ function _beginExecuteScriptActions(resourceGroupName, clusterName, parameters, // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1580,12 +1587,13 @@ function _beginExecuteScriptActions(resourceGroupName, clusterName, parameters, 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1690,12 +1698,13 @@ function _listByResourceGroupNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1817,12 +1826,13 @@ function _listNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/hdInsightManagement/lib/operations/configurations.js b/lib/services/hdInsightManagement/lib/operations/configurations.js index 45f15eb23b..c03268d3e8 100644 --- a/lib/services/hdInsightManagement/lib/operations/configurations.js +++ b/lib/services/hdInsightManagement/lib/operations/configurations.js @@ -22,14 +22,9 @@ const WebResource = msRest.WebResource; * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. - * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -48,7 +43,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _updateHTTPSettings(resourceGroupName, clusterName, parameters, options, callback) { +function _updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -61,7 +56,7 @@ function _updateHTTPSettings(resourceGroupName, clusterName, parameters, options } // Send request - this.beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, options, (err, parsedResult, httpRequest, response) => { + this.beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -93,8 +88,7 @@ function _updateHTTPSettings(resourceGroupName, clusterName, parameters, options * * @param {string} clusterName The name of the cluster. * - * @param {string} configurationName The constant for configuration type of - * gateway. + * @param {string} configurationName The name of the cluster configuration. * * @param {object} [options] Optional Parameters. * @@ -125,6 +119,9 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba } // 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.'); } @@ -137,9 +134,6 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba 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.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 (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.'); } @@ -150,10 +144,10 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -197,12 +191,13 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -257,14 +252,9 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. - * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.username] The HTTP username. - * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -283,7 +273,7 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, options, callback) { +function _beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -293,23 +283,30 @@ function _beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, op if (!callback) { throw new Error('callback cannot be null.'); } - let configurationName = 'gateway'; // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); + if (configurationName === null || configurationName === undefined || typeof configurationName.valueOf() !== 'string') { + throw new Error('configurationName 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.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 (parameters === null || parameters === undefined || typeof parameters !== 'object') { + throw new Error('parameters cannot be null or undefined and it must be of type object.'); + } + for(let valueElement in parameters) { + if (parameters[valueElement] !== null && parameters[valueElement] !== undefined && typeof parameters[valueElement].valueOf() !== 'string') { + throw new Error('parameters[valueElement] 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.'); @@ -321,10 +318,10 @@ function _beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, op // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -356,7 +353,20 @@ function _beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, op let requestModel = null; try { if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['HttpConnectivitySettings']().mapper(); + let requestModelMapper = { + required: true, + serializedName: 'parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }; requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -382,12 +392,13 @@ function _beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, op 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -425,14 +436,9 @@ class Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. - * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -445,11 +451,11 @@ class Configurations { * * @reject {Error} - The error object. */ - updateHTTPSettingsWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) { + updateHTTPSettingsWithHttpOperationResponse(resourceGroupName, clusterName, configurationName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._updateHTTPSettings(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + self._updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -466,14 +472,9 @@ class Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. - * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -501,7 +502,7 @@ class Configurations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - updateHTTPSettings(resourceGroupName, clusterName, parameters, options, optionalCallback) { + updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -510,14 +511,14 @@ class Configurations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._updateHTTPSettings(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + self._updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._updateHTTPSettings(resourceGroupName, clusterName, parameters, options, optionalCallback); + return self._updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback); } } @@ -528,8 +529,7 @@ class Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {string} configurationName The constant for configuration type of - * gateway. + * @param {string} configurationName The name of the cluster configuration. * * @param {object} [options] Optional Parameters. * @@ -563,8 +563,7 @@ class Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {string} configurationName The constant for configuration type of - * gateway. + * @param {string} configurationName The name of the cluster configuration. * * @param {object} [options] Optional Parameters. * @@ -619,14 +618,9 @@ class Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. - * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -639,11 +633,11 @@ class Configurations { * * @reject {Error} - The error object. */ - beginUpdateHTTPSettingsWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) { + beginUpdateHTTPSettingsWithHttpOperationResponse(resourceGroupName, clusterName, configurationName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + self._beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -660,14 +654,9 @@ class Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. - * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -695,7 +684,7 @@ class Configurations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, options, optionalCallback) { + beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -704,14 +693,14 @@ class Configurations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + self._beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginUpdateHTTPSettings(resourceGroupName, clusterName, parameters, options, optionalCallback); + return self._beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback); } } diff --git a/lib/services/hdInsightManagement/lib/operations/extensions.js b/lib/services/hdInsightManagement/lib/operations/extensions.js new file mode 100644 index 0000000000..bdd26325b6 --- /dev/null +++ b/lib/services/hdInsightManagement/lib/operations/extensions.js @@ -0,0 +1,2130 @@ +/* + * 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; + + +/** + * Enables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {object} parameters The Operations Management Suite (OMS) workspace + * parameters. + * + * @param {string} [parameters.workspaceId] The Operations Management Suite + * (OMS) workspace ID. + * + * @param {string} [parameters.primaryKey] The Operations Management Suite + * (OMS) workspace key. + * + * @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 _enableMonitoring(resourceGroupName, clusterName, parameters, 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.beginEnableMonitoring(resourceGroupName, clusterName, parameters, 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); + }); + }); +} + +/** + * Gets the status of Operations Management Suite (OMS) on the HDInsight + * cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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 ClusterMonitoringResponse} 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 _getMonitoringStatus(resourceGroupName, clusterName, 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { + throw new Error('clusterName 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.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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['ClusterMonitoringResponse']().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); + }); +} + + +/** + * Disables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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 _disableMonitoring(resourceGroupName, clusterName, 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.beginDisableMonitoring(resourceGroupName, clusterName, 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); + }); + }); +} + + +/** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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 _create(resourceGroupName, clusterName, extensionName, parameters, 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.beginCreate(resourceGroupName, clusterName, extensionName, parameters, 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); + }); + }); +} + +/** + * Gets the extension properties for the specified HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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 Extension} 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, clusterName, extensionName, 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { + throw new Error('clusterName cannot be null or undefined and it must be of type string.'); + } + if (extensionName === null || extensionName === undefined || typeof extensionName.valueOf() !== 'string') { + throw new Error('extensionName 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.HDInsight/clusters/{clusterName}/extensions/{extensionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); + requestUrl = requestUrl.replace('{extensionName}', encodeURIComponent(extensionName)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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['Extension']().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); + }); +} + + +/** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName, extensionName, 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, clusterName, extensionName, 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); + }); + }); +} + +/** + * Enables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {object} parameters The Operations Management Suite (OMS) workspace + * parameters. + * + * @param {string} [parameters.workspaceId] The Operations Management Suite + * (OMS) workspace ID. + * + * @param {string} [parameters.primaryKey] The Operations Management Suite + * (OMS) workspace key. + * + * @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 _beginEnableMonitoring(resourceGroupName, clusterName, parameters, 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { + throw new Error('clusterName 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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ClusterMonitoringRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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); + }); +} + +/** + * Disables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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 _beginDisableMonitoring(resourceGroupName, clusterName, 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { + throw new Error('clusterName 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.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); + 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 !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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); + }); +} + +/** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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 _beginCreate(resourceGroupName, clusterName, extensionName, parameters, 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { + throw new Error('clusterName cannot be null or undefined and it must be of type string.'); + } + if (extensionName === null || extensionName === undefined || typeof extensionName.valueOf() !== 'string') { + throw new Error('extensionName 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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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.HDInsight/clusters/{clusterName}/extensions/{extensionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); + requestUrl = requestUrl.replace('{extensionName}', encodeURIComponent(extensionName)); + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Extension']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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); + }); +} + +/** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName, extensionName, 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { + throw new Error('clusterName cannot be null or undefined and it must be of type string.'); + } + if (extensionName === null || extensionName === undefined || typeof extensionName.valueOf() !== 'string') { + throw new Error('extensionName 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.HDInsight/clusters/{clusterName}/extensions/{extensionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); + requestUrl = requestUrl.replace('{extensionName}', encodeURIComponent(extensionName)); + 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 !== 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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 Extensions. */ +class Extensions { + /** + * Create a Extensions. + * @param {HDInsightManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._enableMonitoring = _enableMonitoring; + this._getMonitoringStatus = _getMonitoringStatus; + this._disableMonitoring = _disableMonitoring; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._beginEnableMonitoring = _beginEnableMonitoring; + this._beginDisableMonitoring = _beginDisableMonitoring; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + } + + /** + * Enables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {object} parameters The Operations Management Suite (OMS) workspace + * parameters. + * + * @param {string} [parameters.workspaceId] The Operations Management Suite + * (OMS) workspace ID. + * + * @param {string} [parameters.primaryKey] The Operations Management Suite + * (OMS) workspace key. + * + * @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. + */ + enableMonitoringWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._enableMonitoring(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Enables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {object} parameters The Operations Management Suite (OMS) workspace + * parameters. + * + * @param {string} [parameters.workspaceId] The Operations Management Suite + * (OMS) workspace ID. + * + * @param {string} [parameters.primaryKey] The Operations Management Suite + * (OMS) workspace key. + * + * @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. + */ + enableMonitoring(resourceGroupName, clusterName, parameters, 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._enableMonitoring(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._enableMonitoring(resourceGroupName, clusterName, parameters, options, optionalCallback); + } + } + + /** + * Gets the status of Operations Management Suite (OMS) on the HDInsight + * cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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. + */ + getMonitoringStatusWithHttpOperationResponse(resourceGroupName, clusterName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getMonitoringStatus(resourceGroupName, clusterName, 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 Operations Management Suite (OMS) on the HDInsight + * cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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 {ClusterMonitoringResponse} - 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 ClusterMonitoringResponse} 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. + */ + getMonitoringStatus(resourceGroupName, clusterName, 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._getMonitoringStatus(resourceGroupName, clusterName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getMonitoringStatus(resourceGroupName, clusterName, options, optionalCallback); + } + } + + /** + * Disables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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. + */ + disableMonitoringWithHttpOperationResponse(resourceGroupName, clusterName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._disableMonitoring(resourceGroupName, clusterName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Disables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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. + */ + disableMonitoring(resourceGroupName, clusterName, 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._disableMonitoring(resourceGroupName, clusterName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._disableMonitoring(resourceGroupName, clusterName, options, optionalCallback); + } + } + + /** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName, clusterName, extensionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, clusterName, extensionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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. + */ + create(resourceGroupName, clusterName, extensionName, parameters, 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._create(resourceGroupName, clusterName, extensionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, clusterName, extensionName, parameters, options, optionalCallback); + } + } + + /** + * Gets the extension properties for the specified HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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(resourceGroupName, clusterName, extensionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, clusterName, extensionName, 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 extension properties for the specified HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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 {Extension} - 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 Extension} 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, clusterName, extensionName, 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, clusterName, extensionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, clusterName, extensionName, options, optionalCallback); + } + } + + /** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName, extensionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, clusterName, extensionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName, extensionName, 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, clusterName, extensionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, clusterName, extensionName, options, optionalCallback); + } + } + + /** + * Enables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {object} parameters The Operations Management Suite (OMS) workspace + * parameters. + * + * @param {string} [parameters.workspaceId] The Operations Management Suite + * (OMS) workspace ID. + * + * @param {string} [parameters.primaryKey] The Operations Management Suite + * (OMS) workspace key. + * + * @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. + */ + beginEnableMonitoringWithHttpOperationResponse(resourceGroupName, clusterName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginEnableMonitoring(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Enables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {object} parameters The Operations Management Suite (OMS) workspace + * parameters. + * + * @param {string} [parameters.workspaceId] The Operations Management Suite + * (OMS) workspace ID. + * + * @param {string} [parameters.primaryKey] The Operations Management Suite + * (OMS) workspace key. + * + * @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. + */ + beginEnableMonitoring(resourceGroupName, clusterName, parameters, 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._beginEnableMonitoring(resourceGroupName, clusterName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginEnableMonitoring(resourceGroupName, clusterName, parameters, options, optionalCallback); + } + } + + /** + * Disables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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. + */ + beginDisableMonitoringWithHttpOperationResponse(resourceGroupName, clusterName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDisableMonitoring(resourceGroupName, clusterName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Disables the Operations Management Suite (OMS) on the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @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. + */ + beginDisableMonitoring(resourceGroupName, clusterName, 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._beginDisableMonitoring(resourceGroupName, clusterName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDisableMonitoring(resourceGroupName, clusterName, options, optionalCallback); + } + } + + /** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, clusterName, extensionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, clusterName, extensionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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. + */ + beginCreate(resourceGroupName, clusterName, extensionName, parameters, 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._beginCreate(resourceGroupName, clusterName, extensionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, clusterName, extensionName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName, extensionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, clusterName, extensionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName, extensionName, 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, clusterName, extensionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, clusterName, extensionName, options, optionalCallback); + } + } + +} + +module.exports = Extensions; diff --git a/lib/services/hdInsightManagement/lib/operations/index.d.ts b/lib/services/hdInsightManagement/lib/operations/index.d.ts index 14d6059a72..3d60f76937 100644 --- a/lib/services/hdInsightManagement/lib/operations/index.d.ts +++ b/lib/services/hdInsightManagement/lib/operations/index.d.ts @@ -1163,7 +1163,7 @@ export interface Applications { /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -1180,10 +1180,10 @@ export interface Applications { * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByClusterWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -1216,13 +1216,13 @@ export interface Applications { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - list(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; - list(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByCluster(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByCluster(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; + listByCluster(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists properties of the specified application. + * Gets properties of the specified application. * * @param {string} resourceGroupName The name of the resource group. * @@ -1244,7 +1244,7 @@ export interface Applications { getWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists properties of the specified application. + * Gets properties of the specified application. * * @param {string} resourceGroupName The name of the resource group. * @@ -1291,6 +1291,8 @@ export interface Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} parameters The application create request. * * @param {object} [parameters.computeProfile] The list of roles in the @@ -1329,7 +1331,7 @@ export interface Applications { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, clusterName: string, parameters: models.ApplicationGetProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Creates applications for the HDInsight cluster. @@ -1338,6 +1340,8 @@ export interface Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} parameters The application create request. * * @param {object} [parameters.computeProfile] The list of roles in the @@ -1392,9 +1396,9 @@ export interface Applications { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, clusterName: string, parameters: models.ApplicationGetProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, clusterName: string, parameters: models.ApplicationGetProperties, callback: ServiceCallback): void; - create(resourceGroupName: string, clusterName: string, parameters: models.ApplicationGetProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, callback: ServiceCallback): void; + create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1404,6 +1408,8 @@ export interface Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1415,7 +1421,7 @@ export interface Applications { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Deletes the specified application on the HDInsight cluster. @@ -1424,6 +1430,8 @@ export interface Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1450,9 +1458,126 @@ export interface Applications { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, clusterName: string, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, clusterName: string, applicationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, clusterName: string, applicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates applications for the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} applicationName The constant value for the application name. + * + * @param {object} parameters The application create request. + * + * @param {object} [parameters.computeProfile] The list of roles in the + * cluster. + * + * @param {array} [parameters.computeProfile.roles] The list of roles in the + * cluster. + * + * @param {array} [parameters.installScriptActions] The list of install script + * actions. + * + * @param {array} [parameters.uninstallScriptActions] The list of uninstall + * script actions. + * + * @param {array} [parameters.httpsEndpoints] The list of application HTTPS + * endpoints. + * + * @param {array} [parameters.sshEndpoints] The list of application SSH + * endpoints. + * + * @param {string} [parameters.applicationType] The application type. + * + * @param {array} [parameters.errors] The list of errors. + * + * @param {string} [parameters.additionalProperties] The additional properties + * for application. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates applications for the HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} applicationName The constant value for the application name. + * + * @param {object} parameters The application create request. + * + * @param {object} [parameters.computeProfile] The list of roles in the + * cluster. + * + * @param {array} [parameters.computeProfile.roles] The list of roles in the + * cluster. + * + * @param {array} [parameters.installScriptActions] The list of install script + * actions. + * + * @param {array} [parameters.uninstallScriptActions] The list of uninstall + * script actions. + * + * @param {array} [parameters.httpsEndpoints] The list of application HTTPS + * endpoints. + * + * @param {array} [parameters.sshEndpoints] The list of application SSH + * endpoints. + * + * @param {string} [parameters.applicationType] The application type. + * + * @param {array} [parameters.errors] The list of errors. + * + * @param {string} [parameters.additionalProperties] The additional properties + * for application. + * + * @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 {Application} - 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. + * + * {Application} [result] - The deserialized result object if an error did not occur. + * See {@link Application} 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. + */ + beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1462,6 +1587,8 @@ export interface Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1473,7 +1600,7 @@ export interface Applications { * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Deletes the specified application on the HDInsight cluster. @@ -1482,6 +1609,8 @@ export interface Applications { * * @param {string} clusterName The name of the cluster. * + * @param {string} applicationName The constant value for the application name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1508,13 +1637,13 @@ export interface Applications { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, clusterName: string, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, clusterName: string, applicationName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, clusterName: string, applicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1530,10 +1659,10 @@ export interface Applications { * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByClusterNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all of the applications HDInsight cluster. + * Lists all of the applications for the HDInsight cluster. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1565,22 +1694,22 @@ export interface Applications { * * {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; + listByClusterNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByClusterNext(nextPageLink: string, callback: ServiceCallback): void; + listByClusterNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * Location + * Locations * __NOTE__: An instance of this class is automatically created for an * instance of the HDInsightManagementClient. */ -export interface Location { +export interface Locations { /** - * Gets the capabilities for the specified location. + * Lists the usages for the specified location. * * @param {string} location The location to get capabilities for. * @@ -1591,14 +1720,14 @@ export interface Location { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getCapabilitiesWithHttpOperationResponse(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listUsagesWithHttpOperationResponse(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the capabilities for the specified location. + * Lists the usages for the specified location. * * @param {string} location The location to get capabilities for. * @@ -1614,7 +1743,7 @@ export interface Location { * * {Promise} A promise is returned. * - * @resolve {CapabilitiesResult} - The deserialized result object. + * @resolve {UsagesListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1622,16 +1751,16 @@ export interface Location { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {CapabilitiesResult} [result] - The deserialized result object if an error did not occur. - * See {@link CapabilitiesResult} for more information. + * {UsagesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsagesListResult} 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. */ - getCapabilities(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getCapabilities(location: string, callback: ServiceCallback): void; - getCapabilities(location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listUsages(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listUsages(location: string, callback: ServiceCallback): void; + listUsages(location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -1650,14 +1779,9 @@ export interface Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. - * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -1670,7 +1794,7 @@ export interface Configurations { * * @reject {Error|ServiceError} - The error object. */ - updateHTTPSettingsWithHttpOperationResponse(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateHTTPSettingsWithHttpOperationResponse(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Configures the HTTP settings on the specified cluster. @@ -1679,14 +1803,9 @@ export interface Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. - * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -1714,9 +1833,9 @@ export interface Configurations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - updateHTTPSettings(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - updateHTTPSettings(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, callback: ServiceCallback): void; - updateHTTPSettings(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + updateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, callback: ServiceCallback): void; + updateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1726,8 +1845,7 @@ export interface Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {string} configurationName The constant for configuration type of - * gateway. + * @param {string} configurationName The name of the cluster configuration. * * @param {object} [options] Optional Parameters. * @@ -1749,8 +1867,7 @@ export interface Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {string} configurationName The constant for configuration type of - * gateway. + * @param {string} configurationName The name of the cluster configuration. * * @param {object} [options] Optional Parameters. * @@ -1790,14 +1907,9 @@ export interface Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. - * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -1810,7 +1922,7 @@ export interface Configurations { * * @reject {Error|ServiceError} - The error object. */ - beginUpdateHTTPSettingsWithHttpOperationResponse(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateHTTPSettingsWithHttpOperationResponse(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Configures the HTTP settings on the specified cluster. @@ -1819,14 +1931,9 @@ export interface Configurations { * * @param {string} clusterName The name of the cluster. * - * @param {object} parameters The name of the resource group. - * - * @param {string} [parameters.enabledCredential] Whether or not the HTTP based - * authorization is enabled. Possible values include: 'true', 'false' - * - * @param {string} [parameters.username] The HTTP username. + * @param {string} configurationName The name of the cluster configuration. * - * @param {string} [parameters.password] The HTTP user password. + * @param {object} parameters The cluster configurations. * * @param {object} [options] Optional Parameters. * @@ -1854,18 +1961,18 @@ export interface Configurations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, callback: ServiceCallback): void; - beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, parameters: models.HttpConnectivitySettings, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, callback: ServiceCallback): void; + beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ExtensionOperations + * Extensions * __NOTE__: An instance of this class is automatically created for an * instance of the HDInsightManagementClient. */ -export interface ExtensionOperations { +export interface Extensions { /** @@ -2071,6 +2178,8 @@ export interface ExtensionOperations { * * @param {string} clusterName The name of the cluster. * + * @param {string} extensionName The name of the cluster extension. + * * @param {object} parameters The cluster extensions create request. * * @param {string} [parameters.workspaceId] The workspace ID for the cluster @@ -2090,7 +2199,7 @@ export interface ExtensionOperations { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, clusterName: string, parameters: models.Extension, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Creates an HDInsight cluster extension. @@ -2099,6 +2208,8 @@ export interface ExtensionOperations { * * @param {string} clusterName The name of the cluster. * + * @param {string} extensionName The name of the cluster extension. + * * @param {object} parameters The cluster extensions create request. * * @param {string} [parameters.workspaceId] The workspace ID for the cluster @@ -2133,9 +2244,9 @@ export interface ExtensionOperations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, clusterName: string, parameters: models.Extension, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, clusterName: string, parameters: models.Extension, callback: ServiceCallback): void; - create(resourceGroupName: string, clusterName: string, parameters: models.Extension, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, callback: ServiceCallback): void; + create(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2145,6 +2256,8 @@ export interface ExtensionOperations { * * @param {string} clusterName The name of the cluster. * + * @param {string} extensionName The name of the cluster extension. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2156,7 +2269,7 @@ export interface ExtensionOperations { * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, clusterName: string, extensionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets the extension properties for the specified HDInsight cluster extension. @@ -2165,6 +2278,8 @@ export interface ExtensionOperations { * * @param {string} clusterName The name of the cluster. * + * @param {string} extensionName The name of the cluster extension. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2192,9 +2307,9 @@ export interface ExtensionOperations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, clusterName: string, extensionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, clusterName: string, extensionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, clusterName: string, extensionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2204,6 +2319,8 @@ export interface ExtensionOperations { * * @param {string} clusterName The name of the cluster. * + * @param {string} extensionName The name of the cluster extension. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2215,7 +2332,7 @@ export interface ExtensionOperations { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, clusterName: string, extensionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Deletes the specified extension for HDInsight cluster. @@ -2224,6 +2341,8 @@ export interface ExtensionOperations { * * @param {string} clusterName The name of the cluster. * + * @param {string} extensionName The name of the cluster extension. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2250,9 +2369,9 @@ export interface ExtensionOperations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, clusterName: string, extensionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, clusterName: string, extensionName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, clusterName: string, extensionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2387,6 +2506,146 @@ export interface ExtensionOperations { beginDisableMonitoring(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; beginDisableMonitoring(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; beginDisableMonitoring(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates an HDInsight cluster extension. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @param {object} parameters The cluster extensions create request. + * + * @param {string} [parameters.workspaceId] The workspace ID for the cluster + * monitoring extension. + * + * @param {string} [parameters.primaryKey] The certificate for the cluster + * monitoring extensions. + * + * @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. + */ + beginCreate(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, clusterName: string, extensionName: string, parameters: models.Extension, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName: string, extensionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified extension for HDInsight cluster. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} clusterName The name of the cluster. + * + * @param {string} extensionName The name of the cluster extension. + * + * @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, clusterName: string, extensionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, clusterName: string, extensionName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, clusterName: string, extensionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -2478,7 +2737,7 @@ export interface ScriptActions { * * @reject {Error|ServiceError} - The error object. */ - listPersistedScriptsWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByClusterWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Lists all the persisted script actions for the specified cluster. @@ -2514,9 +2773,9 @@ export interface ScriptActions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listPersistedScripts(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listPersistedScripts(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; - listPersistedScripts(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByCluster(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByCluster(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; + listByCluster(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2600,7 +2859,7 @@ export interface ScriptActions { * * @reject {Error|ServiceError} - The error object. */ - listPersistedScriptsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByClusterNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Lists all the persisted script actions for the specified cluster. @@ -2635,9 +2894,9 @@ export interface ScriptActions { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listPersistedScriptsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listPersistedScriptsNext(nextPageLink: string, callback: ServiceCallback): void; - listPersistedScriptsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByClusterNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByClusterNext(nextPageLink: string, callback: ServiceCallback): void; + listByClusterNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -2667,7 +2926,7 @@ export interface ScriptExecutionHistory { * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByClusterWithHttpOperationResponse(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Lists all scripts' execution history for the specified cluster. @@ -2704,9 +2963,9 @@ export interface ScriptExecutionHistory { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - list(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; - list(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByCluster(resourceGroupName: string, clusterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByCluster(resourceGroupName: string, clusterName: string, callback: ServiceCallback): void; + listByCluster(resourceGroupName: string, clusterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2716,7 +2975,7 @@ export interface ScriptExecutionHistory { * * @param {string} clusterName The name of the cluster. * - * @param {number} scriptExecutionId The script execution ID. + * @param {string} scriptExecutionId The script execution Id * * @param {object} [options] Optional Parameters. * @@ -2729,7 +2988,7 @@ export interface ScriptExecutionHistory { * * @reject {Error|ServiceError} - The error object. */ - promoteWithHttpOperationResponse(resourceGroupName: string, clusterName: string, scriptExecutionId: number, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + promoteWithHttpOperationResponse(resourceGroupName: string, clusterName: string, scriptExecutionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Promotes the specified ad-hoc script execution to a persisted script. @@ -2738,7 +2997,7 @@ export interface ScriptExecutionHistory { * * @param {string} clusterName The name of the cluster. * - * @param {number} scriptExecutionId The script execution ID. + * @param {string} scriptExecutionId The script execution Id * * @param {object} [options] Optional Parameters. * @@ -2766,9 +3025,9 @@ export interface ScriptExecutionHistory { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - promote(resourceGroupName: string, clusterName: string, scriptExecutionId: number, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - promote(resourceGroupName: string, clusterName: string, scriptExecutionId: number, callback: ServiceCallback): void; - promote(resourceGroupName: string, clusterName: string, scriptExecutionId: number, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + promote(resourceGroupName: string, clusterName: string, scriptExecutionId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + promote(resourceGroupName: string, clusterName: string, scriptExecutionId: string, callback: ServiceCallback): void; + promote(resourceGroupName: string, clusterName: string, scriptExecutionId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2788,7 +3047,7 @@ export interface ScriptExecutionHistory { * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByClusterNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Lists all scripts' execution history for the specified cluster. @@ -2824,9 +3083,9 @@ export interface ScriptExecutionHistory { * * {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; + listByClusterNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByClusterNext(nextPageLink: string, callback: ServiceCallback): void; + listByClusterNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/hdInsightManagement/lib/operations/index.js b/lib/services/hdInsightManagement/lib/operations/index.js index dff95d910b..73bdb2a273 100644 --- a/lib/services/hdInsightManagement/lib/operations/index.js +++ b/lib/services/hdInsightManagement/lib/operations/index.js @@ -16,9 +16,9 @@ exports.Clusters = require('./clusters'); exports.Applications = require('./applications'); -exports.Location = require('./location'); +exports.Locations = require('./locations'); exports.Configurations = require('./configurations'); -exports.ExtensionOperations = require('./extensionOperations'); +exports.Extensions = require('./extensions'); exports.ScriptActions = require('./scriptActions'); exports.ScriptExecutionHistory = require('./scriptExecutionHistory'); exports.Operations = require('./operations'); diff --git a/lib/services/hdInsightManagement/lib/operations/locations.js b/lib/services/hdInsightManagement/lib/operations/locations.js new file mode 100644 index 0000000000..96c9b339a5 --- /dev/null +++ b/lib/services/hdInsightManagement/lib/operations/locations.js @@ -0,0 +1,252 @@ +/* + * 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; + +/** + * Lists the usages for the specified location. + * + * @param {string} location The location to get capabilities for. + * + * @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 UsagesListResult} 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 _listUsages(location, 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 (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location 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.HDInsight/locations/{location}/usages'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + 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) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().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['UsagesListResult']().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 Locations. */ +class Locations { + /** + * Create a Locations. + * @param {HDInsightManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listUsages = _listUsages; + } + + /** + * Lists the usages for the specified location. + * + * @param {string} location The location to get capabilities for. + * + * @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. + */ + listUsagesWithHttpOperationResponse(location, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listUsages(location, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usages for the specified location. + * + * @param {string} location The location to get capabilities for. + * + * @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 {UsagesListResult} - 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 UsagesListResult} 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. + */ + listUsages(location, 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._listUsages(location, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listUsages(location, options, optionalCallback); + } + } + +} + +module.exports = Locations; diff --git a/lib/services/hdInsightManagement/lib/operations/operations.js b/lib/services/hdInsightManagement/lib/operations/operations.js index a94bc820c3..03fd8a2774 100644 --- a/lib/services/hdInsightManagement/lib/operations/operations.js +++ b/lib/services/hdInsightManagement/lib/operations/operations.js @@ -103,12 +103,13 @@ function _list(options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -230,12 +231,13 @@ function _listNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/hdInsightManagement/lib/operations/scriptActions.js b/lib/services/hdInsightManagement/lib/operations/scriptActions.js index 4b4fba2114..ed8d72fbb7 100644 --- a/lib/services/hdInsightManagement/lib/operations/scriptActions.js +++ b/lib/services/hdInsightManagement/lib/operations/scriptActions.js @@ -52,6 +52,9 @@ function _deleteMethod(resourceGroupName, clusterName, scriptName, options, call } // 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.'); } @@ -64,9 +67,6 @@ function _deleteMethod(resourceGroupName, clusterName, scriptName, options, call 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.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 (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.'); } @@ -77,10 +77,10 @@ function _deleteMethod(resourceGroupName, clusterName, scriptName, options, call // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); requestUrl = requestUrl.replace('{scriptName}', encodeURIComponent(scriptName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -124,12 +124,13 @@ function _deleteMethod(resourceGroupName, clusterName, scriptName, options, call 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -172,7 +173,7 @@ function _deleteMethod(resourceGroupName, clusterName, scriptName, options, call * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listPersistedScripts(resourceGroupName, clusterName, options, callback) { +function _listByCluster(resourceGroupName, clusterName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -184,6 +185,9 @@ function _listPersistedScripts(resourceGroupName, clusterName, options, callback } // 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.'); } @@ -193,9 +197,6 @@ function _listPersistedScripts(resourceGroupName, clusterName, options, callback 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.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 (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.'); } @@ -206,9 +207,9 @@ function _listPersistedScripts(resourceGroupName, clusterName, options, callback // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -252,12 +253,13 @@ function _listPersistedScripts(resourceGroupName, clusterName, options, callback 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -332,6 +334,9 @@ function _getExecutionDetail(resourceGroupName, clusterName, scriptExecutionId, } // 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.'); } @@ -344,9 +349,6 @@ function _getExecutionDetail(resourceGroupName, clusterName, scriptExecutionId, 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.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 (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.'); } @@ -357,10 +359,10 @@ function _getExecutionDetail(resourceGroupName, clusterName, scriptExecutionId, // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); requestUrl = requestUrl.replace('{scriptExecutionId}', encodeURIComponent(scriptExecutionId)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -404,12 +406,13 @@ function _getExecutionDetail(resourceGroupName, clusterName, scriptExecutionId, 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -468,7 +471,7 @@ function _getExecutionDetail(resourceGroupName, clusterName, scriptExecutionId, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listPersistedScriptsNext(nextPageLink, options, callback) { +function _listByClusterNext(nextPageLink, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -531,12 +534,13 @@ function _listPersistedScriptsNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -580,9 +584,9 @@ class ScriptActions { constructor(client) { this.client = client; this._deleteMethod = _deleteMethod; - this._listPersistedScripts = _listPersistedScripts; + this._listByCluster = _listByCluster; this._getExecutionDetail = _getExecutionDetail; - this._listPersistedScriptsNext = _listPersistedScriptsNext; + this._listByClusterNext = _listByClusterNext; } /** @@ -692,11 +696,11 @@ class ScriptActions { * * @reject {Error} - The error object. */ - listPersistedScriptsWithHttpOperationResponse(resourceGroupName, clusterName, options) { + listByClusterWithHttpOperationResponse(resourceGroupName, clusterName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listPersistedScripts(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._listByCluster(resourceGroupName, clusterName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -740,7 +744,7 @@ class ScriptActions { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listPersistedScripts(resourceGroupName, clusterName, options, optionalCallback) { + listByCluster(resourceGroupName, clusterName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -749,14 +753,14 @@ class ScriptActions { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listPersistedScripts(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._listByCluster(resourceGroupName, clusterName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listPersistedScripts(resourceGroupName, clusterName, options, optionalCallback); + return self._listByCluster(resourceGroupName, clusterName, options, optionalCallback); } } @@ -868,11 +872,11 @@ class ScriptActions { * * @reject {Error} - The error object. */ - listPersistedScriptsNextWithHttpOperationResponse(nextPageLink, options) { + listByClusterNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listPersistedScriptsNext(nextPageLink, options, (err, result, request, response) => { + self._listByClusterNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -915,7 +919,7 @@ class ScriptActions { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listPersistedScriptsNext(nextPageLink, options, optionalCallback) { + listByClusterNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -924,14 +928,14 @@ class ScriptActions { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listPersistedScriptsNext(nextPageLink, options, (err, result, request, response) => { + self._listByClusterNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listPersistedScriptsNext(nextPageLink, options, optionalCallback); + return self._listByClusterNext(nextPageLink, options, optionalCallback); } } diff --git a/lib/services/hdInsightManagement/lib/operations/scriptExecutionHistory.js b/lib/services/hdInsightManagement/lib/operations/scriptExecutionHistory.js index 43d00564d3..b1ec440486 100644 --- a/lib/services/hdInsightManagement/lib/operations/scriptExecutionHistory.js +++ b/lib/services/hdInsightManagement/lib/operations/scriptExecutionHistory.js @@ -40,7 +40,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _list(resourceGroupName, clusterName, options, callback) { +function _listByCluster(resourceGroupName, clusterName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -52,6 +52,9 @@ function _list(resourceGroupName, clusterName, options, callback) { } // 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.'); } @@ -61,9 +64,6 @@ function _list(resourceGroupName, clusterName, options, callback) { 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.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 (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.'); } @@ -74,9 +74,9 @@ function _list(resourceGroupName, clusterName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -120,12 +120,13 @@ function _list(resourceGroupName, clusterName, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -167,7 +168,7 @@ function _list(resourceGroupName, clusterName, options, callback) { * * @param {string} clusterName The name of the cluster. * - * @param {number} scriptExecutionId The script execution ID. + * @param {string} scriptExecutionId The script execution Id * * @param {object} [options] Optional Parameters. * @@ -198,21 +199,21 @@ function _promote(resourceGroupName, clusterName, scriptExecutionId, options, ca } // 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 (clusterName === null || clusterName === undefined || typeof clusterName.valueOf() !== 'string') { throw new Error('clusterName cannot be null or undefined and it must be of type string.'); } - if (scriptExecutionId === null || scriptExecutionId === undefined || typeof scriptExecutionId !== 'number') { - throw new Error('scriptExecutionId cannot be null or undefined and it must be of type number.'); + if (scriptExecutionId === null || scriptExecutionId === undefined || typeof scriptExecutionId.valueOf() !== 'string') { + throw new Error('scriptExecutionId 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.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 (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.'); } @@ -223,10 +224,10 @@ function _promote(resourceGroupName, clusterName, scriptExecutionId, options, ca // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{clusterName}', encodeURIComponent(clusterName)); - requestUrl = requestUrl.replace('{scriptExecutionId}', encodeURIComponent(scriptExecutionId.toString())); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{scriptExecutionId}', encodeURIComponent(scriptExecutionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -270,12 +271,13 @@ function _promote(resourceGroupName, clusterName, scriptExecutionId, options, ca 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -318,7 +320,7 @@ function _promote(resourceGroupName, clusterName, scriptExecutionId, options, ca * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listNext(nextPageLink, options, callback) { +function _listByClusterNext(nextPageLink, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -381,12 +383,13 @@ function _listNext(nextPageLink, options, callback) { 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; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -429,9 +432,9 @@ class ScriptExecutionHistory { */ constructor(client) { this.client = client; - this._list = _list; + this._listByCluster = _listByCluster; this._promote = _promote; - this._listNext = _listNext; + this._listByClusterNext = _listByClusterNext; } /** @@ -452,11 +455,11 @@ class ScriptExecutionHistory { * * @reject {Error} - The error object. */ - listWithHttpOperationResponse(resourceGroupName, clusterName, options) { + listByClusterWithHttpOperationResponse(resourceGroupName, clusterName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._list(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._listByCluster(resourceGroupName, clusterName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -501,7 +504,7 @@ class ScriptExecutionHistory { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - list(resourceGroupName, clusterName, options, optionalCallback) { + listByCluster(resourceGroupName, clusterName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -510,14 +513,14 @@ class ScriptExecutionHistory { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._list(resourceGroupName, clusterName, options, (err, result, request, response) => { + self._listByCluster(resourceGroupName, clusterName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._list(resourceGroupName, clusterName, options, optionalCallback); + return self._listByCluster(resourceGroupName, clusterName, options, optionalCallback); } } @@ -528,7 +531,7 @@ class ScriptExecutionHistory { * * @param {string} clusterName The name of the cluster. * - * @param {number} scriptExecutionId The script execution ID. + * @param {string} scriptExecutionId The script execution Id * * @param {object} [options] Optional Parameters. * @@ -562,7 +565,7 @@ class ScriptExecutionHistory { * * @param {string} clusterName The name of the cluster. * - * @param {number} scriptExecutionId The script execution ID. + * @param {string} scriptExecutionId The script execution Id * * @param {object} [options] Optional Parameters. * @@ -627,11 +630,11 @@ class ScriptExecutionHistory { * * @reject {Error} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink, options) { + listByClusterNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { + self._listByClusterNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -675,7 +678,7 @@ class ScriptExecutionHistory { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listNext(nextPageLink, options, optionalCallback) { + listByClusterNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -684,14 +687,14 @@ class ScriptExecutionHistory { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { + self._listByClusterNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listNext(nextPageLink, options, optionalCallback); + return self._listByClusterNext(nextPageLink, options, optionalCallback); } } diff --git a/lib/services/hdInsightManagement/package.json b/lib/services/hdInsightManagement/package.json index 52771f8831..62ee3aa132 100644 --- a/lib/services/hdInsightManagement/package.json +++ b/lib/services/hdInsightManagement/package.json @@ -2,9 +2,9 @@ "name": "azure-arm-hdinsight", "author": "Microsoft Corporation", "description": "HDInsightManagementClient Library with typescript type definitions for node", - "version": "0.3.1", + "version": "0.4.0", "dependencies": { - "ms-rest": "^2.3.2", + "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" }, "keywords": [ From ae7c6752e54c8aa64106cf07682d629a993582a7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 18 Jul 2018 15:52:18 +0000 Subject: [PATCH 2/3] Generated from 4c456589d58f5fde08f253f411fb2ce4ea50de80 Bump hdinsight Node.js package version to 0.5.0 --- .../lib/operations/configurations.js | 42 +++++++++---------- .../lib/operations/index.d.ts | 24 +++++------ lib/services/hdInsightManagement/package.json | 2 +- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/services/hdInsightManagement/lib/operations/configurations.js b/lib/services/hdInsightManagement/lib/operations/configurations.js index c03268d3e8..1cb15ca527 100644 --- a/lib/services/hdInsightManagement/lib/operations/configurations.js +++ b/lib/services/hdInsightManagement/lib/operations/configurations.js @@ -16,7 +16,7 @@ const WebResource = msRest.WebResource; /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -43,7 +43,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, callback) { +function _update(resourceGroupName, clusterName, configurationName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -56,7 +56,7 @@ function _updateHTTPSettings(resourceGroupName, clusterName, configurationName, } // Send request - this.beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, parsedResult, httpRequest, response) => { + this.beginUpdate(resourceGroupName, clusterName, configurationName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -246,7 +246,7 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba } /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -273,7 +273,7 @@ function _get(resourceGroupName, clusterName, configurationName, options, callba * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, callback) { +function _beginUpdate(resourceGroupName, clusterName, configurationName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -424,13 +424,13 @@ class Configurations { */ constructor(client) { this.client = client; - this._updateHTTPSettings = _updateHTTPSettings; + this._update = _update; this._get = _get; - this._beginUpdateHTTPSettings = _beginUpdateHTTPSettings; + this._beginUpdate = _beginUpdate; } /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -451,11 +451,11 @@ class Configurations { * * @reject {Error} - The error object. */ - updateHTTPSettingsWithHttpOperationResponse(resourceGroupName, clusterName, configurationName, parameters, options) { + updateWithHttpOperationResponse(resourceGroupName, clusterName, configurationName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { + self._update(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -466,7 +466,7 @@ class Configurations { } /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -502,7 +502,7 @@ class Configurations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback) { + update(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -511,14 +511,14 @@ class Configurations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { + self._update(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._updateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback); + return self._update(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback); } } @@ -612,7 +612,7 @@ class Configurations { } /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -633,11 +633,11 @@ class Configurations { * * @reject {Error} - The error object. */ - beginUpdateHTTPSettingsWithHttpOperationResponse(resourceGroupName, clusterName, configurationName, parameters, options) { + beginUpdateWithHttpOperationResponse(resourceGroupName, clusterName, configurationName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { + self._beginUpdate(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -648,7 +648,7 @@ class Configurations { } /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -684,7 +684,7 @@ class Configurations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback) { + beginUpdate(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -693,14 +693,14 @@ class Configurations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { + self._beginUpdate(resourceGroupName, clusterName, configurationName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginUpdateHTTPSettings(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback); + return self._beginUpdate(resourceGroupName, clusterName, configurationName, parameters, options, optionalCallback); } } diff --git a/lib/services/hdInsightManagement/lib/operations/index.d.ts b/lib/services/hdInsightManagement/lib/operations/index.d.ts index 3d60f76937..5494d105ed 100644 --- a/lib/services/hdInsightManagement/lib/operations/index.d.ts +++ b/lib/services/hdInsightManagement/lib/operations/index.d.ts @@ -1773,7 +1773,7 @@ export interface Configurations { /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -1794,10 +1794,10 @@ export interface Configurations { * * @reject {Error|ServiceError} - The error object. */ - updateHTTPSettingsWithHttpOperationResponse(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -1833,9 +1833,9 @@ export interface Configurations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - updateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - updateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, callback: ServiceCallback): void; - updateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, callback: ServiceCallback): void; + update(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1901,7 +1901,7 @@ export interface Configurations { /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -1922,10 +1922,10 @@ export interface Configurations { * * @reject {Error|ServiceError} - The error object. */ - beginUpdateHTTPSettingsWithHttpOperationResponse(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Configures the HTTP settings on the specified cluster. + * Configures the configuration on the specified cluster. * * @param {string} resourceGroupName The name of the resource group. * @@ -1961,9 +1961,9 @@ export interface Configurations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, callback: ServiceCallback): void; - beginUpdateHTTPSettings(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, clusterName: string, configurationName: string, parameters: { [propertyName: string]: string }, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/hdInsightManagement/package.json b/lib/services/hdInsightManagement/package.json index 62ee3aa132..a643f907a5 100644 --- a/lib/services/hdInsightManagement/package.json +++ b/lib/services/hdInsightManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-hdinsight", "author": "Microsoft Corporation", "description": "HDInsightManagementClient Library with typescript type definitions for node", - "version": "0.4.0", + "version": "0.5.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" From a789f6b741240dd66a7adf1ff70f5ca8a8584a60 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 27 Aug 2018 17:01:09 +0000 Subject: [PATCH 3/3] Generated from 3ca20321ea84d8878da6e53c88b5573436110ddc Update hdinsight resource-manager Node.js package version to 0.6.0 --- .../lib/hDInsightManagementClient.d.ts | 6 +- .../lib/hDInsightManagementClient.js | 6 +- .../lib/models/clusterPatchParameters.js | 1 + .../lib/operations/applications.js | 236 +++++++++++------- .../lib/operations/index.d.ts | 172 +++++++------ lib/services/hdInsightManagement/package.json | 6 +- 6 files changed, 249 insertions(+), 178 deletions(-) diff --git a/lib/services/hdInsightManagement/lib/hDInsightManagementClient.d.ts b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.d.ts index 6e2ce8a6ec..64552d14c3 100644 --- a/lib/services/hdInsightManagement/lib/hDInsightManagementClient.d.ts +++ b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.d.ts @@ -34,11 +34,11 @@ export default class HDInsightManagementClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @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); diff --git a/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js index 9adc73f697..a3ef2cc6b8 100644 --- a/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js +++ b/lib/services/hdInsightManagement/lib/hDInsightManagementClient.js @@ -34,9 +34,9 @@ class HDInsightManagementClient extends ServiceClient { * @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] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @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) { diff --git a/lib/services/hdInsightManagement/lib/models/clusterPatchParameters.js b/lib/services/hdInsightManagement/lib/models/clusterPatchParameters.js index 41f7ae05d5..1b9ef6a912 100644 --- a/lib/services/hdInsightManagement/lib/models/clusterPatchParameters.js +++ b/lib/services/hdInsightManagement/lib/models/clusterPatchParameters.js @@ -38,6 +38,7 @@ class ClusterPatchParameters { modelProperties: { tags: { required: false, + nullable: true, serializedName: 'tags', type: { name: 'Dictionary', diff --git a/lib/services/hdInsightManagement/lib/operations/applications.js b/lib/services/hdInsightManagement/lib/operations/applications.js index 6d031ddc04..0ed56c4852 100644 --- a/lib/services/hdInsightManagement/lib/operations/applications.js +++ b/lib/services/hdInsightManagement/lib/operations/applications.js @@ -324,30 +324,37 @@ function _get(resourceGroupName, clusterName, applicationName, options, callback * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.tags] The tags for the application. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {object} [parameters.properties] The properties of the application. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {string} [parameters.applicationType] The application type. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. + * + * @param {string} [parameters.properties.applicationType] The application + * type. + * + * @param {array} [parameters.properties.errors] The list of errors. + * + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -495,30 +502,37 @@ function _deleteMethod(resourceGroupName, clusterName, applicationName, options, * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application + * + * @param {object} [parameters.tags] The tags for the application. + * + * @param {object} [parameters.properties] The properties of the application. * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {array} [parameters.errors] The list of errors. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {array} [parameters.properties.errors] The list of errors. + * + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -613,7 +627,7 @@ function _beginCreate(resourceGroupName, clusterName, applicationName, parameter let requestModel = null; try { if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ApplicationProperties']().mapper(); + let requestModelMapper = new client.models['Application']().mapper(); requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -1146,30 +1160,37 @@ class Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application + * + * @param {object} [parameters.tags] The tags for the application. + * + * @param {object} [parameters.properties] The properties of the application. + * + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.errors] The list of errors. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -1207,30 +1228,37 @@ class Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.tags] The tags for the application. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {object} [parameters.properties] The properties of the application. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {string} [parameters.applicationType] The application type. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. + * + * @param {string} [parameters.properties.applicationType] The application + * type. + * + * @param {array} [parameters.properties.errors] The list of errors. + * + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -1379,30 +1407,37 @@ class Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application + * + * @param {object} [parameters.tags] The tags for the application. + * + * @param {object} [parameters.properties] The properties of the application. * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {array} [parameters.errors] The list of errors. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {array} [parameters.properties.errors] The list of errors. + * + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -1440,30 +1475,37 @@ class Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application + * + * @param {object} [parameters.tags] The tags for the application. + * + * @param {object} [parameters.properties] The properties of the application. + * + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.errors] The list of errors. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/hdInsightManagement/lib/operations/index.d.ts b/lib/services/hdInsightManagement/lib/operations/index.d.ts index 5494d105ed..945eccb685 100644 --- a/lib/services/hdInsightManagement/lib/operations/index.d.ts +++ b/lib/services/hdInsightManagement/lib/operations/index.d.ts @@ -1295,30 +1295,37 @@ export interface Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.tags] The tags for the application. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {object} [parameters.properties] The properties of the application. + * + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. + * + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. + * + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.errors] The list of errors. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -1331,7 +1338,7 @@ export interface Applications { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Creates applications for the HDInsight cluster. @@ -1344,30 +1351,37 @@ export interface Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.tags] The tags for the application. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {object} [parameters.properties] The properties of the application. + * + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. + * + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. + * + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.errors] The list of errors. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -1396,9 +1410,9 @@ export interface Applications { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, callback: ServiceCallback): void; - create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, callback: ServiceCallback): void; + create(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1474,30 +1488,37 @@ export interface Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.tags] The tags for the application. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {object} [parameters.properties] The properties of the application. + * + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. + * + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. + * + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.errors] The list of errors. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -1510,7 +1531,7 @@ export interface Applications { * * @reject {Error|ServiceError} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateWithHttpOperationResponse(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Creates applications for the HDInsight cluster. @@ -1523,30 +1544,37 @@ export interface Applications { * * @param {object} parameters The application create request. * - * @param {object} [parameters.computeProfile] The list of roles in the - * cluster. + * @param {string} [parameters.etag] The ETag for the application * - * @param {array} [parameters.computeProfile.roles] The list of roles in the - * cluster. + * @param {object} [parameters.tags] The tags for the application. * - * @param {array} [parameters.installScriptActions] The list of install script - * actions. + * @param {object} [parameters.properties] The properties of the application. + * + * @param {object} [parameters.properties.computeProfile] The list of roles in + * the cluster. + * + * @param {array} [parameters.properties.computeProfile.roles] The list of + * roles in the cluster. + * + * @param {array} [parameters.properties.installScriptActions] The list of + * install script actions. * - * @param {array} [parameters.uninstallScriptActions] The list of uninstall - * script actions. + * @param {array} [parameters.properties.uninstallScriptActions] The list of + * uninstall script actions. * - * @param {array} [parameters.httpsEndpoints] The list of application HTTPS - * endpoints. + * @param {array} [parameters.properties.httpsEndpoints] The list of + * application HTTPS endpoints. * - * @param {array} [parameters.sshEndpoints] The list of application SSH - * endpoints. + * @param {array} [parameters.properties.sshEndpoints] The list of application + * SSH endpoints. * - * @param {string} [parameters.applicationType] The application type. + * @param {string} [parameters.properties.applicationType] The application + * type. * - * @param {array} [parameters.errors] The list of errors. + * @param {array} [parameters.properties.errors] The list of errors. * - * @param {string} [parameters.additionalProperties] The additional properties - * for application. + * @param {string} [parameters.properties.additionalProperties] The additional + * properties for application. * * @param {object} [options] Optional Parameters. * @@ -1575,9 +1603,9 @@ export interface Applications { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, callback: ServiceCallback): void; - beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.ApplicationProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, clusterName: string, applicationName: string, parameters: models.Application, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** diff --git a/lib/services/hdInsightManagement/package.json b/lib/services/hdInsightManagement/package.json index a643f907a5..718806a3da 100644 --- a/lib/services/hdInsightManagement/package.json +++ b/lib/services/hdInsightManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-hdinsight", "author": "Microsoft Corporation", "description": "HDInsightManagementClient Library with typescript type definitions for node", - "version": "0.5.0", + "version": "0.6.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" @@ -14,12 +14,12 @@ "license": "MIT", "main": "./lib/hDInsightManagementClient.js", "types": "./lib/hDInsightManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } }